/* menu - fontSize */ import $ from '../../util/dom-core.js' import DropList from '../droplist.js' // 构造函数 function FontSize(editor) { this.editor = editor this.$elem = $('
') this.type = 'droplist' // 当前是否 active 状态 this._active = false // 初始化 droplist this.droplist = new DropList(this, { width: 160, $title: $('字号
'), type: 'list', // droplist 以列表形式展示 list: [ { $elem: $('x-small'), value: '1' }, { $elem: $('small'), value: '2' }, { $elem: $('normal'), value: '3' }, { $elem: $('large'), value: '4' }, { $elem: $('x-large'), value: '5' }, { $elem: $('xx-large'), value: '6' } ], onClick: (value) => { // 注意 this 是指向当前的 FontSize 对象 this._command(value) } }) } // 原型 FontSize.prototype = { constructor: FontSize, // 执行命令 _command: function (value) { const editor = this.editor editor.cmd.do('fontSize', value) } } export default FontSize