convert multi_select to an option
This commit is contained in:
parent
e5ce9e7aee
commit
e0ce741f5b
1 changed files with 24 additions and 2 deletions
|
|
@ -867,13 +867,16 @@ exports.onSessionChange = function(e) {
|
|||
// adds multiple selection support to the editor
|
||||
// (note: should be called only once for each editor instance)
|
||||
function MultiSelect(editor) {
|
||||
if (editor.$multiselectOnSessionChange)
|
||||
return;
|
||||
editor.$onAddRange = editor.$onAddRange.bind(editor);
|
||||
editor.$onRemoveRange = editor.$onRemoveRange.bind(editor);
|
||||
editor.$onMultiSelect = editor.$onMultiSelect.bind(editor);
|
||||
editor.$onSingleSelect = editor.$onSingleSelect.bind(editor);
|
||||
editor.$multiselectOnSessionChange = exports.onSessionChange.bind(editor);
|
||||
|
||||
exports.onSessionChange.call(editor, editor);
|
||||
editor.on("changeSession", exports.onSessionChange.bind(editor));
|
||||
editor.$multiselectOnSessionChange(editor);
|
||||
editor.on("changeSession", editor.$multiselectOnSessionChange);
|
||||
|
||||
editor.on("mousedown", onMouseDown);
|
||||
editor.commands.addCommands(commands.defaultCommands);
|
||||
|
|
@ -908,4 +911,23 @@ function addAltCursorListeners(editor){
|
|||
|
||||
exports.MultiSelect = MultiSelect;
|
||||
|
||||
|
||||
require("./config").defineOptions(Editor.prototype, "editor", {
|
||||
enableMultiselect: {
|
||||
set: function(val) {
|
||||
MultiSelect(this);
|
||||
if (val) {
|
||||
this.on("changeSession", this.$multiselectOnSessionChange);
|
||||
this.on("mousedown", onMouseDown);
|
||||
} else {
|
||||
this.off("changeSession", this.$multiselectOnSessionChange);
|
||||
this.off("mousedown", onMouseDown);
|
||||
}
|
||||
},
|
||||
value: true
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
|
||||
});
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue