提交 090bdad3 authored 作者: 蔡芬's avatar 蔡芬

font 面板新增颜色值输入,对应文件修改

node_modules\@ckeditor\ckeditor5-font\src\ui\
上级 72280a61
新增了颜色值输入框
文件新增:
colorinputview.js
jscolor.js
代码新增
colortableview.js
标记 //add
\ No newline at end of file
import View from '@ckeditor/ckeditor5-ui/src/view';
import {jscolor} from './jscolor';
const JsColorOptions = {
hash: true,
borderRadius: 2,
borderWidth: 0,
padding: 8,
uppercase: false,
closable: true,
width: 150,
buttonHeight: 24
};
export default class ColorInputView extends View {
constructor(locale, closeButtonLabel) {
super(locale);
const bind = this.bindTemplate;
this.closeButtonLabel = closeButtonLabel;
this.items = this.createCollection();
this.set('value');
this.set('parent');
this.setTemplate({
tag: 'input',
attributes: {
class: ['ck', 'ck-color-input'],
},
on: {
blur: bind.to('blur')
}
});
}
setInputValue(newValue) {
const value = !newValue ? '#000000' : newValue;
if (this.colorPicker) {
this.colorPicker.fromString(value);
} else if (this.element){
this.element.value = value;
}
}
getInputValue() {
console.log('getInputValue', this.colorPicker, this.element);
if (this.colorPicker) {
return this.colorPicker.toHEXString();
} else if (this.element){
return this.element.value;
}
}
outBlur() {
console.log( 'div' );
}
render() {
super.render();
this.on('change:value', (evt, name, value) => {
this.setInputValue(value);
});
this.on('blur', (evt, name, value) => {
console.log('0-blur')
});
this.on('change:parent', (evt, name, value) => {
let options = Object.assign({}, JsColorOptions, {
closeText: this.closeButtonLabel,
container: value
});
this.colorPicker = new jscolor(this.element, options);
this.setInputValue(this.value);
});
}
}
差异被折叠。
差异被折叠。
Markdown 格式
0% 或
您添加了 0 人 到此讨论。请谨慎行事。
请先完成此评论的编辑!
请 注册 或者 后发表评论