Skip to content

Commit

Permalink
Merge branch 'kmoe-superscript-subscript' into reedsy
Browse files Browse the repository at this point in the history
  • Loading branch information
pedrosanta committed Aug 12, 2015
2 parents d529eea + ae8caf4 commit e66135e
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 4 deletions.
2 changes: 2 additions & 0 deletions examples/index.jade
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,8 @@ 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-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
Expand Down
8 changes: 8 additions & 0 deletions src/core/format.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,14 @@ class Format
tag: 'S'
prepare: 'strikeThrough'

superscript:
tag: 'SUP'
prepare: 'superscript'

subscript:
tag: 'SUB'
prepare: 'subscript'

color:
style: 'color'
default: 'rgb(0, 0, 0)'
Expand Down
3 changes: 2 additions & 1 deletion src/modules/keyboard.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -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
)
)
Expand Down
2 changes: 1 addition & 1 deletion src/modules/toolbar.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ class Toolbar
@formats:
LINE : { 'align', 'bullet', 'list', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'quote' }
SELECT : { 'align', 'background', 'color', 'font', 'size' }
TOGGLE : { 'bold', 'bullet', 'image', 'italic', 'link', 'list', 'strike', 'underline', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'quote' }
TOGGLE : { 'bold', 'bullet', 'image', 'italic', 'link', 'list', 'strike', 'underline', 'superscript', 'subscript', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'quote' }
TOOLTIP : { 'image', 'link' }

constructor: (@quill, @options) ->
Expand Down
5 changes: 4 additions & 1 deletion src/modules/undo-manager.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion src/quill.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ class Quill extends EventEmitter2
@themes: []

@DEFAULTS:
formats: ['align', 'bold', 'italic', 'strike', 'underline', 'color', 'background', 'font', 'size', 'link', 'image', 'bullet', 'list', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'quote']
formats: ['align', 'bold', 'italic', 'strike', 'underline', 'superscript', 'subscript', 'color', 'background', 'font', 'size', 'link', 'image', 'bullet', 'list', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'quote']
modules:
'keyboard': true
'paste-manager': true
Expand Down

0 comments on commit e66135e

Please sign in to comment.