From 9b2e524a8a679139499823fddc3d958f4ffdb1fa Mon Sep 17 00:00:00 2001 From: Jason Chen Date: Tue, 4 Aug 2015 12:06:50 -0700 Subject: [PATCH 1/4] support ctrl+y to redo on windows Closes #429 --- src/modules/undo-manager.coffee | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/modules/undo-manager.coffee b/src/modules/undo-manager.coffee index b829984f62..ff5988bec1 100644 --- a/src/modules/undo-manager.coffee +++ b/src/modules/undo-manager.coffee @@ -26,7 +26,10 @@ class UndoManager this.undo() return false ) - keyboard.addHotkey(UndoManager.hotkeys.REDO, => + redoKey = [UndoManager.hotkeys.REDO] + if (navigator.platform.indexOf('Win') > -1) + redoKey.push({ key: 'Y', metaKey: true }) + keyboard.addHotkey(redoKey, => @quill.editor.checkUpdate() this.redo() return false From c5d2ede5d1b51941965bd88b59297114c7a29a31 Mon Sep 17 00:00:00 2001 From: Jason Chen Date: Tue, 4 Aug 2015 13:13:51 -0700 Subject: [PATCH 2/4] fixes #432 --- src/modules/keyboard.coffee | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/modules/keyboard.coffee b/src/modules/keyboard.coffee index 8118d80f99..568b3b9371 100644 --- a/src/modules/keyboard.coffee +++ b/src/modules/keyboard.coffee @@ -92,7 +92,8 @@ class Keyboard ) _.each(['bold', 'italic', 'underline'], (format) => this.addHotkey(Keyboard.hotkeys[format.toUpperCase()], (range) => - this.toggleFormat(range, format) + if (@quill.options.formats.indexOf(format) > -1) + this.toggleFormat(range, format) return false ) ) From a8e55c2a64ce44d59048830161eb56199f16f94a Mon Sep 17 00:00:00 2001 From: kmoe Date: Wed, 5 Aug 2015 19:04:39 +0100 Subject: [PATCH 3/4] add superscript support --- examples/index.jade | 1 + src/core/format.coffee | 4 ++++ src/modules/toolbar.coffee | 2 +- src/quill.coffee | 2 +- 4 files changed, 7 insertions(+), 2 deletions(-) diff --git a/examples/index.jade b/examples/index.jade index c0963b6071..3b09eb9c2d 100644 --- a/examples/index.jade +++ b/examples/index.jade @@ -45,6 +45,7 @@ html button.ql-format-button.ql-italic(title='Italic') Italic button.ql-format-button.ql-underline(title='Underline') Under button.ql-format-button.ql-strike(title='Strikethrough') Strike + button.ql-format-button.ql-superscript(title='Superscript') Super button.ql-format-button.ql-link(title='Link') Link button.ql-format-button.ql-image(title='Image') Image button.ql-format-button.ql-bullet(title='Bullet') Bullet diff --git a/src/core/format.coffee b/src/core/format.coffee index 3ef2120d17..178f8acf9e 100644 --- a/src/core/format.coffee +++ b/src/core/format.coffee @@ -24,6 +24,10 @@ class Format tag: 'S' prepare: 'strikeThrough' + superscript: + tag: 'SUP' + prepare: 'superscript' + color: style: 'color' default: 'rgb(0, 0, 0)' diff --git a/src/modules/toolbar.coffee b/src/modules/toolbar.coffee index c7de876b3e..a100d74e9c 100644 --- a/src/modules/toolbar.coffee +++ b/src/modules/toolbar.coffee @@ -10,7 +10,7 @@ class Toolbar @formats: LINE : { 'align', 'bullet', 'list' } SELECT : { 'align', 'background', 'color', 'font', 'size' } - TOGGLE : { 'bold', 'bullet', 'image', 'italic', 'link', 'list', 'strike', 'underline' } + TOGGLE : { 'bold', 'bullet', 'image', 'italic', 'link', 'list', 'strike', 'underline', 'superscript' } TOOLTIP : { 'image', 'link' } constructor: (@quill, @options) -> diff --git a/src/quill.coffee b/src/quill.coffee index faeee21ae1..d0a6e46f80 100644 --- a/src/quill.coffee +++ b/src/quill.coffee @@ -18,7 +18,7 @@ class Quill extends EventEmitter2 @themes: [] @DEFAULTS: - formats: ['align', 'bold', 'italic', 'strike', 'underline', 'color', 'background', 'font', 'size', 'link', 'image', 'bullet', 'list'] + formats: ['align', 'bold', 'italic', 'strike', 'underline', 'superscript', 'color', 'background', 'font', 'size', 'link', 'image', 'bullet', 'list'] modules: 'keyboard': true 'paste-manager': true From 7845c4fbf521bda821f2c0c792f1ca4c613a3f3e Mon Sep 17 00:00:00 2001 From: kmoe Date: Thu, 6 Aug 2015 14:30:27 +0100 Subject: [PATCH 4/4] add subscript support --- examples/index.jade | 1 + src/core/format.coffee | 4 ++++ src/modules/toolbar.coffee | 2 +- src/quill.coffee | 2 +- 4 files changed, 7 insertions(+), 2 deletions(-) diff --git a/examples/index.jade b/examples/index.jade index 3b09eb9c2d..aa574131a2 100644 --- a/examples/index.jade +++ b/examples/index.jade @@ -46,6 +46,7 @@ html button.ql-format-button.ql-underline(title='Underline') Under button.ql-format-button.ql-strike(title='Strikethrough') Strike button.ql-format-button.ql-superscript(title='Superscript') Super + button.ql-format-button.ql-subscript(title='Subscript') Sub button.ql-format-button.ql-link(title='Link') Link button.ql-format-button.ql-image(title='Image') Image button.ql-format-button.ql-bullet(title='Bullet') Bullet diff --git a/src/core/format.coffee b/src/core/format.coffee index 178f8acf9e..291d7a0c70 100644 --- a/src/core/format.coffee +++ b/src/core/format.coffee @@ -28,6 +28,10 @@ class Format tag: 'SUP' prepare: 'superscript' + subscript: + tag: 'SUB' + prepare: 'subscript' + color: style: 'color' default: 'rgb(0, 0, 0)' diff --git a/src/modules/toolbar.coffee b/src/modules/toolbar.coffee index a100d74e9c..c4e9e7b495 100644 --- a/src/modules/toolbar.coffee +++ b/src/modules/toolbar.coffee @@ -10,7 +10,7 @@ class Toolbar @formats: LINE : { 'align', 'bullet', 'list' } SELECT : { 'align', 'background', 'color', 'font', 'size' } - TOGGLE : { 'bold', 'bullet', 'image', 'italic', 'link', 'list', 'strike', 'underline', 'superscript' } + TOGGLE : { 'bold', 'bullet', 'image', 'italic', 'link', 'list', 'strike', 'underline', 'superscript', 'subscript' } TOOLTIP : { 'image', 'link' } constructor: (@quill, @options) -> diff --git a/src/quill.coffee b/src/quill.coffee index d0a6e46f80..646995f770 100644 --- a/src/quill.coffee +++ b/src/quill.coffee @@ -18,7 +18,7 @@ class Quill extends EventEmitter2 @themes: [] @DEFAULTS: - formats: ['align', 'bold', 'italic', 'strike', 'underline', 'superscript', 'color', 'background', 'font', 'size', 'link', 'image', 'bullet', 'list'] + formats: ['align', 'bold', 'italic', 'strike', 'underline', 'superscript', 'subscript', 'color', 'background', 'font', 'size', 'link', 'image', 'bullet', 'list'] modules: 'keyboard': true 'paste-manager': true