Skip to content

Commit

Permalink
first commit to disable editor
Browse files Browse the repository at this point in the history
  • Loading branch information
Alan Hong committed Dec 7, 2015
1 parent d51d4e5 commit 752b0a3
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 4 deletions.
14 changes: 10 additions & 4 deletions src/js/bs3/module/Toolbar.js
Expand Up @@ -43,13 +43,19 @@ define(function () {
}
};

this.activate = function () {
var $btn = $toolbar.find('button').not('.btn-codeview');
this.activate = function (isIncludeCodeview) {
var $btn = $toolbar.find('button');
if (!isIncludeCodeview) {
$btn = $btn.not('.btn-codeview');
}
ui.toggleBtn($btn, true);
};

this.deactivate = function () {
var $btn = $toolbar.find('button').not('.btn-codeview');
this.deactivate = function (isIncludeCodeview) {
var $btn = $toolbar.find('button');
if (!isIncludeCodeview) {
$btn = $btn.not('.btn-codeview');
}
ui.toggleBtn($btn, false);
};
};
Expand Down
14 changes: 14 additions & 0 deletions src/js/summernote.js
Expand Up @@ -73,6 +73,20 @@ define([
}
};

this.isDisabled = function () {
return this.layoutInfo.editable.attr('contenteditable') === 'false';
};

this.enable = function () {
this.layoutInfo.editable.attr('contenteditable', true);
this.invoke('toolbar.activate', true);
};

this.disable = function () {
this.layoutInfo.editable.attr('contenteditable', false);
this.invoke('toolbar.deactivate', true);
};

this.triggerEvent = function () {
var namespace = list.head(arguments);
var args = list.tail(list.from(arguments));
Expand Down

0 comments on commit 752b0a3

Please sign in to comment.