-
Notifications
You must be signed in to change notification settings - Fork 44
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[IMP] styles: add support of indentation #4425
base: master
Are you sure you want to change the base?
Conversation
This commit adds the support of indentation. Import and export of indentation from xlsx is also supported. Task: 3984459
ae328e8
to
df64ee1
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
More features 🥳 Is the next step to allow evaluation to return style ? I didn't follow the conversation on how he want to handle the indent in the pivots 😅
I added some testing notes in the task's pad
@@ -74,6 +74,11 @@ export const demoData = { | |||
F2: { style: 5, content: "italic blablah" }, | |||
F3: { style: 6, content: "strikethrough" }, | |||
F4: { style: 7, content: "underline" }, | |||
F16: { content: "Indent 0" }, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nitpick & personal opinion: I think the first demo sheet is cluttered enough, I'm not a fan of adding things in the middle. How about adding them below existing data instead ?
case "SET_FORMATTING": | ||
const hasStyle = "style" in cmd; | ||
if (hasStyle && cmd.style?.indent && cmd.style.indent < 0) { | ||
return CommandResult.IndentLevelError; | ||
} | ||
return CommandResult.Success; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can use checkIncorrectIndentLevel no ?
@@ -1315,6 +1315,22 @@ describe("Menu Item actions", () => { | |||
}); | |||
}); | |||
|
|||
test("Format -> indentation", () => { | |||
doAction(["format", "format_increase_indent"], env); | |||
expect(dispatch).toHaveBeenCalledWith("SET_FORMATTING", { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Lucas-sensei once told be that it was better to check the effect of the menu item in the sheet, rather than checking that a command was dispatched 🤓
@@ -75,6 +75,7 @@ const simpleData = { | |||
A38: { content: `='<Sheet2>'!B2` }, | |||
A39: { content: `=A39` }, | |||
A40: { content: `=(1+2)/3` }, | |||
A41: { content: `Indented text`, style: 12 }, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The commit says that the xlsx import works. I don't think I saw it implemented ? Or at least it's not tested
@@ -713,7 +722,7 @@ export class GridRenderer { | |||
return box; | |||
} | |||
|
|||
private getGridBoxes(): Box[] { | |||
private getGridBoxes(renderingContext: GridRenderingContext): Box[] { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm pretty sure someone once told me that we wanted to keep the creation of grid boxes independant from the ctx
. Was it @rrahir ?
We could easily have the indent be fontsize * randomConstant
, rather to bother having to measure space characters with the context
@@ -399,6 +399,15 @@ topbarMenuRegistry | |||
...ACTION_FORMAT.formatWrappingClip, | |||
sequence: 30, | |||
}) | |||
.addChild("format_increase_indent", ["format"], { | |||
...ACTION_FORMAT.styleIncreaseIndent, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd swap the entries, I feel like the button to indent (translate text to the right) shoudlbe at the right (& vice versa)
This commit adds the support of indentation. Import and export of indentation from xlsx is also supported.
Task: 3984459
Description:
description of this task, what is implemented and why it is implemented that way.
Task: : TASK_ID
review checklist