/* menu - header */ import $ from '../../util/dom-core.js' import DropList from '../droplist.js' // 构造函数 function Questionborder(editor) { this.editor = editor this.$elem = $('
') this.type = 'droplist' // 当前是否 active 状态 this._active = false // 初始化 droplist this.droplist = new DropList(this, { width: 100, $title: $('题框
'), type: 'list', // droplist 以列表形式展示 list: [ { $elem: $('客观题框
'), value: 'question_1' }, { $elem: $('主观题框
'), value: 'question_2' } ], onClick: (value) => { // 注意 this 是指向当前的 Head 对象 this._command(value) } }) } // 原型 Questionborder.prototype = { constructor: Questionborder, // 执行命令 _command: function (value) { console.log(value) let funName = 'lsiten_' + value; if (this[funName]) { this[funName](); } }, lsiten_question_1: function () { this.editor.cmd.do('border', {type: 1, data: { row: 2, column: 3 }}); }, lsiten_question_2: function () { this.editor.cmd.do('border', {type: 2, data: {}}); } } export default Questionborder