diff --git a/static/js/html-editor.js b/static/js/html-editor.js index ca8a7488..94be65ea 100644 --- a/static/js/html-editor.js +++ b/static/js/html-editor.js @@ -342,4 +342,16 @@ $(function () { layer.msg("没有需要发布的文档") } }; + + $(window).resize(function(e) { + var $container = $(editor.$textContainerElem.elems[0]); + var $manual = $container.closest('.manual-wangEditor'); + var maxHeight = $manual.closest('.manual-editor-container').innerHeight(); + var statusHeight = $manual.siblings('.manual-editor-status').outerHeight(true); + var manualHeihgt = maxHeight - statusHeight; + $manual.height(manualHeihgt); + var toolbarHeight = $container.siblings('.w-e-toolbar').outerHeight(true); + $container.height($container.parent().innerHeight() - toolbarHeight); + }); + $(window).trigger('resize'); }); \ No newline at end of file diff --git a/static/js/wangEditor-plugins/attach-menu.js b/static/js/wangEditor-plugins/attach-menu.js new file mode 100644 index 00000000..70b04144 --- /dev/null +++ b/static/js/wangEditor-plugins/attach-menu.js @@ -0,0 +1,42 @@ +(function () { + + // 获取 wangEditor 构造函数和 jquery + var E = window.wangEditor; + var $ = window.jQuery; + + let AttachMenu = (function (_BtnMenu) { + c2b_inherits(AttachMenu, _BtnMenu); + + var _super = c2b_createSuper(AttachMenu); + + function AttachMenu(editor) { + c2b_classCallCheck(this, AttachMenu); + + const $elem = E.$(`
`); + return _super.call(this, $elem, editor); + } + + c2b_createClass(AttachMenu, [ + { + key: "clickHandler", + value: function clickHandler() { + $("#uploadAttachModal").modal("show"); + } + }, + { + key: "tryChangeActive", + value: function tryChangeActive() { + // this.active(); + } + } + ]); + + return AttachMenu; + })(E.BtnMenu); + + + var menuKey = 'attach'; + E.registerMenu(menuKey, AttachMenu); +})(); \ No newline at end of file diff --git a/static/js/wangEditor-plugins/history-menu.js b/static/js/wangEditor-plugins/history-menu.js new file mode 100644 index 00000000..245660ff --- /dev/null +++ b/static/js/wangEditor-plugins/history-menu.js @@ -0,0 +1,42 @@ +(function () { + + // 获取 wangEditor 构造函数和 jquery + var E = window.wangEditor; + var $ = window.jQuery; + + let HistoryMenu = (function (_BtnMenu) { + c2b_inherits(HistoryMenu, _BtnMenu); + + var _super = c2b_createSuper(HistoryMenu); + + function HistoryMenu(editor) { + c2b_classCallCheck(this, HistoryMenu); + + const $elem = E.$(` `); + return _super.call(this, $elem, editor); + } + + c2b_createClass(HistoryMenu, [ + { + key: "clickHandler", + value: function clickHandler() { + window.documentHistory(); + } + }, + { + key: "tryChangeActive", + value: function tryChangeActive() { + // this.active(); + } + } + ]); + + return HistoryMenu; + })(E.BtnMenu); + + + var menuKey = '历史'; + E.registerMenu(menuKey, HistoryMenu); +})(); \ No newline at end of file diff --git a/static/js/wangEditor-plugins/release-menu.js b/static/js/wangEditor-plugins/release-menu.js new file mode 100644 index 00000000..88cf36d9 --- /dev/null +++ b/static/js/wangEditor-plugins/release-menu.js @@ -0,0 +1,42 @@ +(function () { + + // 获取 wangEditor 构造函数和 jquery + var E = window.wangEditor; + var $ = window.jQuery; + + let ReleaseMenu = (function (_BtnMenu) { + c2b_inherits(ReleaseMenu, _BtnMenu); + + var _super = c2b_createSuper(ReleaseMenu); + + function ReleaseMenu(editor) { + c2b_classCallCheck(this, ReleaseMenu); + + const $elem = E.$(` `); + return _super.call(this, $elem, editor); + } + + c2b_createClass(ReleaseMenu, [ + { + key: "clickHandler", + value: function clickHandler() { + window.releaseBook(); + } + }, + { + key: "tryChangeActive", + value: function tryChangeActive() { + // this.active(); + } + } + ]); + + return ReleaseMenu; + })(E.BtnMenu); + + + var menuKey = 'release'; + E.registerMenu(menuKey, ReleaseMenu); +})(); \ No newline at end of file diff --git a/static/wangEditor/old/plugins/attach-menu.js b/static/wangEditor/old/plugins/attach-menu.js deleted file mode 100644 index 6be0fef8..00000000 --- a/static/wangEditor/old/plugins/attach-menu.js +++ /dev/null @@ -1,47 +0,0 @@ -(function () { - - // 获取 wangEditor 构造函数和 jquery - var E = window.wangEditor; - var $ = window.jQuery; - - // 用 createMenu 方法创建菜单 - E.createMenu(function (check) { - - // 定义菜单id,不要和其他菜单id重复。编辑器自带的所有菜单id,可通过『参数配置-自定义菜单』一节查看 - var menuId = 'attach'; - - // check将检查菜单配置(『参数配置-自定义菜单』一节描述)中是否该菜单id,如果没有,则忽略下面的代码。 - if (!check(menuId)) { - return; - } - - // this 指向 editor 对象自身 - var editor = this; - - // 创建 menu 对象 - var menu = new E.Menu({ - editor: editor, // 编辑器对象 - id: menuId, // 菜单id - title: '附件', // 菜单标题 - - // 正常状态和选中状态下的dom对象,样式需要自定义 - $domNormal: $(''), - $domSelected: $('') - }); - - - // 菜单正常状态下,点击将触发该事件 - menu.clickEvent = function (e) { - $("#uploadAttachModal").modal("show"); - }; - - - // 菜单选中状态下,点击将触发该事件 - menu.clickEventSelected = function (e) { - - }; - // 增加到editor对象中 - editor.menus[menuId] = menu; - }); - -})(); \ No newline at end of file diff --git a/static/wangEditor/old/plugins/history-menu.js b/static/wangEditor/old/plugins/history-menu.js deleted file mode 100644 index a0a6ccc8..00000000 --- a/static/wangEditor/old/plugins/history-menu.js +++ /dev/null @@ -1,47 +0,0 @@ -(function () { - - // 获取 wangEditor 构造函数和 jquery - var E = window.wangEditor; - var $ = window.jQuery; - - // 用 createMenu 方法创建菜单 - E.createMenu(function (check) { - - // 定义菜单id,不要和其他菜单id重复。编辑器自带的所有菜单id,可通过『参数配置-自定义菜单』一节查看 - var menuId = 'history'; - - // check将检查菜单配置(『参数配置-自定义菜单』一节描述)中是否该菜单id,如果没有,则忽略下面的代码。 - if (!check(menuId)) { - return; - } - - // this 指向 editor 对象自身 - var editor = this; - - // 创建 menu 对象 - var menu = new E.Menu({ - editor: editor, // 编辑器对象 - id: menuId, // 菜单id - title: '历史', // 菜单标题 - - // 正常状态和选中状态下的dom对象,样式需要自定义 - $domNormal: $(''), - $domSelected: $('') - }); - - // 菜单正常状态下,点击将触发该事件 - menu.clickEvent = function (e) { - window.documentHistory(); - }; - - // 菜单选中状态下,点击将触发该事件 - menu.clickEventSelected = function (e) { - - }; - - - // 增加到editor对象中 - editor.menus[menuId] = menu; - }); - -})(); \ No newline at end of file diff --git a/static/wangEditor/old/plugins/release-menu.js b/static/wangEditor/old/plugins/release-menu.js deleted file mode 100644 index 4dfec50c..00000000 --- a/static/wangEditor/old/plugins/release-menu.js +++ /dev/null @@ -1,47 +0,0 @@ -(function () { - - // 获取 wangEditor 构造函数和 jquery - var E = window.wangEditor; - var $ = window.jQuery; - - // 用 createMenu 方法创建菜单 - E.createMenu(function (check) { - - // 定义菜单id,不要和其他菜单id重复。编辑器自带的所有菜单id,可通过『参数配置-自定义菜单』一节查看 - var menuId = 'release'; - - // check将检查菜单配置(『参数配置-自定义菜单』一节描述)中是否该菜单id,如果没有,则忽略下面的代码。 - if (!check(menuId)) { - return; - } - - // this 指向 editor 对象自身 - var editor = this; - - // 创建 menu 对象 - var menu = new E.Menu({ - editor: editor, // 编辑器对象 - id: menuId, // 菜单id - title: '发布', // 菜单标题 - - // 正常状态和选中状态下的dom对象,样式需要自定义 - $domNormal: $(''), - $domSelected: $('') - }); - - // 菜单正常状态下,点击将触发该事件 - menu.clickEvent = function (e) { - window.releaseBook(); - }; - - // 菜单选中状态下,点击将触发该事件 - menu.clickEventSelected = function (e) { - - }; - - - // 增加到editor对象中 - editor.menus[menuId] = menu; - }); - -})(); \ No newline at end of file diff --git a/views/document/html_edit_template.tpl b/views/document/html_edit_template.tpl index 23fd3597..188a9533 100644 --- a/views/document/html_edit_template.tpl +++ b/views/document/html_edit_template.tpl @@ -79,6 +79,9 @@