devexpress-richedit
Version:
DevExpress Rich Text Editor is an advanced word-processing tool designed for working with rich text documents.
35 lines (34 loc) • 1.43 kB
JavaScript
import { Chunk } from '../../../../model/chunk';
import { Pair } from '@devexpress/utils/lib/class/pair';
import { BaseFormatter, StdProps } from '../base-formatter';
import { ShortString } from '../short-string';
export class CCF_Chunk extends BaseFormatter {
isHandleObject(obj) {
return obj instanceof Chunk;
}
getShortDescription(_config) {
const list = [
new Pair("", `[${this.curr.startLogPosition.value}, ${this.curr.textBuffer.length}]`),
new Pair("", new ShortString(this.curr.textBuffer, 20)),
];
if (this.curr.isLast)
list.push(new Pair("", "last"));
return this.stdShow(new StdProps(list).showAsLine());
}
availableFullDescription(_config) {
return true;
}
getFullDescription(_config) {
const list = [
new Pair("startPos", this.curr.startLogPosition.value),
new Pair("endPos", this.curr.getEndPosition()),
new Pair("length", this.curr.textBuffer.length),
new Pair("runs", this.curr.textRuns),
new Pair("text", this.getRawText(this.curr.textBuffer).setLen(30)),
];
if (this.curr.isLast)
list.push(new Pair("isLast", this.curr.isLast));
return this.stdShow(new StdProps(list).showAsColumn());
}
}
CCF_Chunk._foo = BaseFormatter.addToFormattersList(new CCF_Chunk());