/war/src/main/webapp/js/admin/editor.js
http://github.com/b3log/b3log-solo · JavaScript · 91 lines · 37 code · 8 blank · 46 comment · 1 complexity · 4574198a0cb3fdc716e3e5089487ff98 MD5 · raw file
- /*
- * Copyright (c) 2009, 2010, 2011, 2012, B3log Team
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
- /**
- * @fileoverview editor
- *
- * @author <a href="mailto:LLY219@gmail.com">Liyuan Li</a>
- * @version 1.0.0.3, Apr 29, 2012
- */
-
- admin.editors = {};
-
- /*
- * @description Create Editor can use all editor.
- * e.g: TinyMCE, wnd
- * @constructor
- * @param conf ????????
- * @param conf.kind ????? simple/all
- * @param conf.id ??????? id
- * @param conf.language ???????
- * @param conf.type ?????
- * @param conf.codeMirrorLanguage codeMirror ?????????
- */
- var Editor = function (conf) {
- this._defaults = {
- type: "tinyMCE",
- kind: "",
- id: "",
- language: ""
- };
- conf.type = Label.editorType;
- this.conf = conf;
- this._init();
- };
-
- $.extend(Editor.prototype, {
- /*
- * @description ???
- */
- _init: function () {
- this.init();
- },
-
- /*
- * @description ??????
- */
- init: function () {
- var conf = this.conf;
-
- var types = conf.type.split("-");
- if (types.length === 2) {
- conf.codeMirrorLanguage = types[1];
- conf.type = types[0];
- }
- admin.editors[conf.type].init(conf);
- },
-
- /*
- * @description ??????
- * @returns {string} ????
- */
- getContent: function () {
- var conf = this.conf;
- return admin.editors[conf.type].getContent(conf.id);
- },
-
- /*
- * @description ??????
- * @param {string} content ???????
- */
- setContent: function (content) {
- var conf = this.conf;
- admin.editors[conf.type].setContent(conf.id, content);
- }
- });
-
- admin.editorArticle = {};
- admin.editorAbstract = {};
- admin.editorPage = {};