Skip to content

Commit

Permalink
default matchers should run before users
Browse files Browse the repository at this point in the history
fix #843
  • Loading branch information
jhchen committed Aug 3, 2016
1 parent 1ec6e6e commit 8192c0b
Showing 1 changed file with 13 additions and 12 deletions.
25 changes: 13 additions & 12 deletions modules/clipboard.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,17 @@ import { SizeStyle } from '../formats/size';

let debug = logger('quill:clipboard');

const CLIPBOARD_CONFIG = [
[Node.TEXT_NODE, matchText],
['br', matchBreak],
[Node.ELEMENT_NODE, matchNewline],
[Node.ELEMENT_NODE, matchBlot],
[Node.ELEMENT_NODE, matchSpacing],
[Node.ELEMENT_NODE, matchAttributor],
[Node.ELEMENT_NODE, matchStyles],
['b', matchAlias.bind(matchAlias, 'bold')],
['i', matchAlias.bind(matchAlias, 'italic')]
];

const STYLE_ATTRIBUTORS = [
AlignStyle,
Expand All @@ -36,7 +47,7 @@ class Clipboard extends Module {
this.container.setAttribute('contenteditable', true);
this.container.setAttribute('tabindex', -1);
this.matchers = [];
this.options.matchers.forEach((pair) => {
CLIPBOARD_CONFIG.concat(this.options.matchers).forEach((pair) => {
this.addMatcher(...pair);
});
}
Expand Down Expand Up @@ -118,17 +129,7 @@ class Clipboard extends Module {
}
}
Clipboard.DEFAULTS = {
matchers: [
[Node.TEXT_NODE, matchText],
['br', matchBreak],
[Node.ELEMENT_NODE, matchNewline],
[Node.ELEMENT_NODE, matchBlot],
[Node.ELEMENT_NODE, matchSpacing],
[Node.ELEMENT_NODE, matchAttributor],
[Node.ELEMENT_NODE, matchStyles],
['b', matchAlias.bind(matchAlias, 'bold')],
['i', matchAlias.bind(matchAlias, 'italic')]
]
matchers: []
};


Expand Down

0 comments on commit 8192c0b

Please sign in to comment.