Skip to content

Commit

Permalink
refactor: jquery plugin name tuiEditorViewer to tuiEditor
Browse files Browse the repository at this point in the history
  • Loading branch information
kyuwoo.choi committed Dec 22, 2017
1 parent 848c83c commit 2bfc0de
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
6 changes: 3 additions & 3 deletions src/js/index.js
Expand Up @@ -4,7 +4,7 @@
*/
import $ from 'jquery';

import ToastUIEditor from './editor';
import Editor from './editor';

// for jquery
$.fn.tuiEditor = function(...args) {
Expand All @@ -23,12 +23,12 @@ $.fn.tuiEditor = function(...args) {
}
} else {
options.el = el;
instance = ToastUIEditor.factory(options);
instance = Editor.factory(options);
$.data(el, 'tuiEditor', instance);
}
}

return this;
};

module.exports = ToastUIEditor;
module.exports = Editor;
12 changes: 6 additions & 6 deletions src/js/indexViewer.js
Expand Up @@ -4,31 +4,31 @@
*/
import $ from 'jquery';

import ToastUIEditorViewer from './viewer';
import Viewer from './viewer';

// for jquery
$.fn.tuiEditorViewer = function(...args) {
$.fn.tuiEditor = function(...args) {
let options, instance;

const el = this.get(0);

if (el) {
options = args[0] || {};

instance = $.data(el, 'tuiEditorViewer');
instance = $.data(el, 'tuiEditor');

if (instance) {
if (typeof options === 'string') {
return instance[options](...args.slice(1));
}
} else {
options.el = el;
instance = new ToastUIEditorViewer(options);
$.data(el, 'tuiEditorViewer', instance);
instance = new Viewer(options);
$.data(el, 'tuiEditor', instance);
}
}

return this;
};

module.exports = ToastUIEditorViewer;
module.exports = Viewer;

0 comments on commit 2bfc0de

Please sign in to comment.