diff --git a/src/public/app/widgets/type_widgets/editable_text.js b/src/public/app/widgets/type_widgets/editable_text.js index e378e0c17..b290a8338 100644 --- a/src/public/app/widgets/type_widgets/editable_text.js +++ b/src/public/app/widgets/type_widgets/editable_text.js @@ -384,22 +384,150 @@ export default class EditableTextTypeWidget extends AbstractTextTypeWidget { } textRemoveFormatCommand() { - this.watchdog.editor.execute('removeFormat', {value:'null'}); + this.watchdog.editor.execute('removeFormat', {value: 'null'}); + } + + setFontColor(color) { + this.watchdog.editor.execute('fontColor', {value: color}); } textRemoveColorCommand() { - this.watchdog.editor.execute('fontColor', {value:'null'}); + this.setFontColor('null'); + } + + textColorRedCommand() { + this.setFontColor('hsl(0, 75%, 60%)'); + } + + textColorOrangeCommand() { + this.setFontColor('hsl(30, 75%, 60%)'); } textColorYellowCommand() { - this.watchdog.editor.execute('fontColor', {value:'hsl(60, 75%, 60%)'}); + this.setFontColor('hsl(60, 75%, 60%)'); + } + + textColorLightGreenCommand() { + this.setFontColor('hsl(90, 75%, 60%)'); } textColorGreenCommand() { - this.watchdog.editor.execute('fontColor', {value:'hsl(120, 75%, 60%)'}); + this.setFontColor('hsl(120, 75%, 60%)'); } - textColorTurquoiseCommand() { - this.watchdog.editor.execute('fontColor', {value:'hsl(120, 75%, 60%)'}); + textColorAquamarineCommand() { + this.setFontColor('hsl(150, 75%, 60%)'); + } + + textColorLightBlueCommand() { + this.setFontColor('hsl(210, 75%, 60%)'); + } + + textColorBlueCommand() { + this.setFontColor('hsl(240, 75%, 60%)'); + } + + textColorPurpleCommand() { + this.setFontColor('hsl(270, 75%, 60%)'); + } + + setHighlight(color) { + this.watchdog.editor.execute('fontBackgroundColor', {value: color}); + } + + textRemoveHighlightCommand() { + this.setHighlight('null'); + } + + textHighlightRedCommand() { + this.setHighlight('hsl(0, 75%, 60%)'); + } + + textHighlightOrangeCommand() { + this.setHighlight('hsl(30, 75%, 60%)'); + } + + textHighlightYellowCommand() { + this.setHighlight('hsl(60, 75%, 60%)'); + } + + textHighlightLightGreenCommand() { + this.setHighlight('hsl(90, 75%, 60%)'); + } + + textHighlightGreenCommand() { + this.setHighlight('hsl(120, 75%, 60%)'); + } + + textHighlightAquamarineCommand() { + this.setHighlight('hsl(150, 75%, 60%)'); + } + + textHighlightLightBlueCommand() { + this.setHighlight('hsl(210, 75%, 60%)'); + } + + textHighlightBlueCommand() { + this.setHighlight('hsl(240, 75%, 60%)'); + } + + textHighlightPurpleCommand() { + this.setHighlight('hsl(270, 75%, 60%)'); + } + + setFontSize(value) { + this.watchdog.editor.execute('fontSize', {value}); + } + + textSizeTinyCommand() { + this.setFontSize('tiny'); + } + + textSizeSmallCommand() { + this.setFontSize('small'); + } + + textSizeDefaultCommand() { + this.setFontSize('default'); + } + + textSizeBigCommand() { + this.setFontSize('big'); + } + + textSizeHugeCommand() { + this.setFontSize('huge'); + } + + textInlineCodeCommand() { + this.watchdog.editor.execute('code', {value: 'null'}); + } + + setHeading(value) { + this.watchdog.editor.execute('heading', {value}); + } + + textParagraphCommand() { + this.setHeading('paragraph'); + } + + textHeading2Command() { + this.setHeading('heading2'); + } + + textHeading3Command() { + this.setHeading('heading3'); + } + + textHeading4Command() { + this.setHeading('heading4'); + } + + textHeading5Command() { + this.setHeading('heading5'); + } + + textHeading6Command() { + this.setHeading('heading6'); } } diff --git a/src/services/keyboard_actions.js b/src/services/keyboard_actions.js index 6f207591b..cffcc54d6 100644 --- a/src/services/keyboard_actions.js +++ b/src/services/keyboard_actions.js @@ -339,209 +339,197 @@ const DEFAULT_KEYBOARD_ACTIONS = [ }, { actionName: "textRemoveColor", - defaultShortcuts: ["CommandOrControl+`"], + defaultShortcuts: ["CommandOrControl+0"], description: "Remove color", scope: "text-detail" }, - { - actionName: "textColorYellow", - defaultShortcuts: ["CommandOrControl+1"], - description: "Color text with yellow", - scope: "text-detail" - }, - { - actionName: "textColorGreen", - defaultShortcuts: ["CommandOrControl+2"], - description: "Color text with green", - scope: "text-detail" - }, - { - actionName: "textColorTurquoise", - defaultShortcuts: ["CommandOrControl+3"], - description: "Color text with turquoise", - scope: "text-detail" - }, { actionName: "textColorRed", - defaultShortcuts: ["CommandOrControl+4"], + defaultShortcuts: ["CommandOrControl+1"], description: "Color text with red", scope: "text-detail" }, { actionName: "textColorOrange", - defaultShortcuts: ["CommandOrControl+5"], + defaultShortcuts: ["CommandOrControl+2"], description: "Color text with orange", scope: "text-detail" }, + { + actionName: "textColorYellow", + defaultShortcuts: ["CommandOrControl+3"], + description: "Color text with yellow", + scope: "text-detail" + }, { actionName: "textColorLightGreen", - defaultShortcuts: ["CommandOrControl+6"], + defaultShortcuts: ["CommandOrControl+4"], description: "Color text with light green", scope: "text-detail" }, + { + actionName: "textColorGreen", + defaultShortcuts: ["CommandOrControl+5"], + description: "Color text with green", + scope: "text-detail" + }, { actionName: "textColorAquamarine", - defaultShortcuts: ["CommandOrControl+7"], + defaultShortcuts: ["CommandOrControl+6"], description: "Color text with aquamarine", scope: "text-detail" }, { actionName: "textColorLightBlue", - defaultShortcuts: ["CommandOrControl+8"], + defaultShortcuts: ["CommandOrControl+7"], description: "Color text with light blue", scope: "text-detail" }, { actionName: "textColorBlue", - defaultShortcuts: ["CommandOrControl+9"], + defaultShortcuts: ["CommandOrControl+8"], description: "Color text with blue", scope: "text-detail" }, { actionName: "textColorPurple", - defaultShortcuts: ["CommandOrControl+0"], + defaultShortcuts: ["CommandOrControl+9"], description: "Color text with purple", scope: "text-detail" }, { actionName: "textRemoveHighlight", - defaultShortcuts: ["CommandOrControl+Shift+`"], + defaultShortcuts: ["CommandOrControl+Shift+0"], description: "Remove highlight", scope: "text-detail" }, - { - actionName: "textHighlightYellow", - defaultShortcuts: ["CommandOrControl+Shift+1"], - description: "Highlight text with yellow", - scope: "text-detail" - }, - { - actionName: "textHighlightGreen", - defaultShortcuts: ["CommandOrControl+Shift+2"], - description: "Highlight text with green", - scope: "text-detail" - }, - { - actionName: "textHighlightTurquoise", - defaultShortcuts: ["CommandOrControl+Shift+3"], - description: "Highlight text with turquoise", - scope: "text-detail" - }, { actionName: "textHighlightRed", - defaultShortcuts: ["CommandOrControl+Shift+4"], + defaultShortcuts: ["CommandOrControl+Shift+1"], description: "Highlight text with red", scope: "text-detail" }, { actionName: "textHighlightOrange", - defaultShortcuts: ["CommandOrControl+Shift+5"], + defaultShortcuts: ["CommandOrControl+Shift+2"], description: "Highlight text with orange", scope: "text-detail" }, + { + actionName: "textHighlightYellow", + defaultShortcuts: ["CommandOrControl+Shift+3"], + description: "Highlight text with yellow", + scope: "text-detail" + }, { actionName: "textHighlightLightGreen", - defaultShortcuts: ["CommandOrControl+Shift+6"], + defaultShortcuts: ["CommandOrControl+Shift+4"], description: "Highlight text with light green", scope: "text-detail" }, + { + actionName: "textHighlightGreen", + defaultShortcuts: ["CommandOrControl+Shift+5"], + description: "Highlight text with green", + scope: "text-detail" + }, { actionName: "textHighlightAquamarine", - defaultShortcuts: ["CommandOrControl+Shift+7"], + defaultShortcuts: ["CommandOrControl+Shift+6"], description: "Highlight text with aquamarine", scope: "text-detail" }, { actionName: "textHighlightLightBlue", - defaultShortcuts: ["CommandOrControl+Shift+8"], + defaultShortcuts: ["CommandOrControl+Shift+7"], description: "Highlight text with light blue", scope: "text-detail" }, { actionName: "textHighlightBlue", - defaultShortcuts: ["CommandOrControl+Shift+9"], + defaultShortcuts: ["CommandOrControl+Shift+8"], description: "Highlight text with blue", scope: "text-detail" }, { actionName: "textHighlightPurple", - defaultShortcuts: ["CommandOrControl+Shift+0"], + defaultShortcuts: ["CommandOrControl+Shift+9"], description: "Highlight text with purple", scope: "text-detail" }, { actionName: "textSizeTiny", - defaultShortcuts: ["CommandOrControl+Alt+Shift+a"], + defaultShortcuts: ["CommandOrControl+Alt+a"], description: "Set text size to tiny", scope: "text-detail" }, { actionName: "textSizeSmall", - defaultShortcuts: ["CommandOrControl+Alt+Shift+s"], + defaultShortcuts: ["CommandOrControl+Alt+s"], description: "Set text size to small", scope: "text-detail" }, { actionName: "textSizeDefault", - defaultShortcuts: ["CommandOrControl+Alt+Shift+d"], + defaultShortcuts: ["CommandOrControl+Alt+d"], description: "Set text size to default", scope: "text-detail" }, { actionName: "textSizeBig", - defaultShortcuts: ["CommandOrControl+Alt+Shift+f"], + defaultShortcuts: ["CommandOrControl+Alt+f"], description: "Set text size to big", scope: "text-detail" }, { actionName: "textSizeHuge", - defaultShortcuts: ["CommandOrControl+Alt+Shift+g"], + defaultShortcuts: ["CommandOrControl+Alt+g"], description: "Set text size to huge", scope: "text-detail" }, { actionName: "textParagraph", - defaultShortcuts: ["CommandOrControl+Alt+Shift+0"], + defaultShortcuts: ["CommandOrControl+Alt+0"], description: "Paragraph", scope: "text-detail" }, { actionName: "textHeading2", - defaultShortcuts: ["CommandOrControl+Alt+Shift+2"], + defaultShortcuts: ["CommandOrControl+Alt+2"], description: "Heading 2", scope: "text-detail" }, { actionName: "textHeading3", - defaultShortcuts: ["CommandOrControl+Alt+Shift+3"], + defaultShortcuts: ["CommandOrControl+Alt+3"], description: "Heading 3", scope: "text-detail" }, { actionName: "textHeading4", - defaultShortcuts: ["CommandOrControl+Alt+Shift+4"], + defaultShortcuts: ["CommandOrControl+Alt+4"], description: "Heading 4", scope: "text-detail" }, { actionName: "textHeading5", - defaultShortcuts: ["CommandOrControl+Alt+Shift+5"], + defaultShortcuts: ["CommandOrControl+Alt+5"], description: "Heading 5", scope: "text-detail" }, { actionName: "textHeading6", - defaultShortcuts: ["CommandOrControl+Alt+Shift+6"], + defaultShortcuts: ["CommandOrControl+Alt+6"], description: "Heading 6", scope: "text-detail" }, { actionName: "textInlineCode", - defaultShortcuts: ["CommandOrControl+Alt+Shift+c"], + defaultShortcuts: ["CommandOrControl+Alt+c"], description: "Inline code", scope: "text-detail" },