From c6c11c54ef62ed5c87dc7eb8139805a2889cbcc8 Mon Sep 17 00:00:00 2001 From: Yukai Huang Date: Sun, 9 Apr 2017 21:14:23 +0800 Subject: [PATCH] Expose internal editor config variable --- public/js/index.js | 7 +++---- public/js/lib/editor/index.js | 1 + 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/public/js/index.js b/public/js/index.js index 9a8ee11..d34bfa9 100644 --- a/public/js/index.js +++ b/public/js/index.js @@ -78,7 +78,6 @@ import { import { preventXSS } from './render' import Editor from './lib/editor' -import EditorConfig from './lib/editor/config' import getUIElements from './lib/editor/ui-elements' @@ -446,7 +445,7 @@ $(document).ready(function () { /* we need this only on touch devices */ if (window.isTouchDevice) { /* cache dom references */ - var $body = jQuery('body') + var $body = $('body') /* bind events */ $(document) @@ -2082,8 +2081,8 @@ socket.on('permission', function (data) { var permission = null socket.on('refresh', function (data) { // console.log(data); - EditorConfig.docmaxlength = data.docmaxlength - editor.setOption('maxLength', EditorConfig.docmaxlength) + editorInstance.config.docmaxlength = data.docmaxlength + editor.setOption('maxLength', editorInstance.config.docmaxlength) updateInfo(data) updatePermission(data.permission) if (!window.loaded) { diff --git a/public/js/lib/editor/index.js b/public/js/lib/editor/index.js index 8cab486..2991998 100644 --- a/public/js/lib/editor/index.js +++ b/public/js/lib/editor/index.js @@ -119,6 +119,7 @@ export default class Editor { } } this.eventListeners = {} + this.config = config } on (event, cb) {