Skip to content

Commit

Permalink
handlers for no theme behavior
Browse files Browse the repository at this point in the history
  • Loading branch information
jhchen committed Aug 2, 2016
1 parent a00d17a commit 1109d3f
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion modules/toolbar.js
Original file line number Diff line number Diff line change
Expand Up @@ -95,10 +95,12 @@ class Toolbar extends Module {
if (this.handlers[format] != null) {
this.handlers[format].call(this, value);
} else if (Parchment.query(format).prototype instanceof Parchment.Embed) {
value = prompt(`Enter ${format}`);
if (!value) return;
this.quill.updateContents(new Delta()
.retain(range.index)
.delete(range.length)
.insert({ [format]: true })
.insert({ [format]: value })
, Quill.sources.USER);
} else {
this.quill.format(format, value, Quill.sources.USER);
Expand Down Expand Up @@ -225,6 +227,12 @@ Toolbar.DEFAULTS = {
}
this.quill.format('direction', value, Quill.sources.USER);
},
link: function(value) {
if (value === true) {
value = prompt('Enter link URL:');
}
this.quill.format('link', value, Quill.sources.USER);
},
indent: function(value) {
let range = this.quill.getSelection();
let formats = this.quill.getFormat(range);
Expand Down

0 comments on commit 1109d3f

Please sign in to comment.