devexpress-richedit
Version:
DevExpress Rich Text Editor is an advanced word-processing tool designed for working with rich text documents.
27 lines (26 loc) • 1.49 kB
JavaScript
import { MapCreator } from '../../../../../../common/utils/map-creator';
import { CompatSettings } from '../../../../../../common/model/compat-settings';
import { CompatibilityMode } from '../../../../../../common/model/document-model';
import { ElementDestination, LeafElementDestination } from '../destination';
export class DocumentSettingsCompatDestination extends ElementDestination {
static { this.handlerTable = new MapCreator()
.add('compatSetting', (data) => new DocumentSettingsCompatSettingDestination(data))
.get(); }
get elementHandlerTable() {
return DocumentSettingsCompatDestination.handlerTable;
}
}
export class DocumentSettingsCompatSettingDestination extends LeafElementDestination {
async processElementOpen(reader) {
const compatSettings = new CompatSettings();
compatSettings.name = this.data.readerHelper.readAttribute(reader, 'name');
compatSettings.uri = this.data.readerHelper.readAttribute(reader, 'uri');
compatSettings.value = this.data.readerHelper.readAttribute(reader, 'val');
this.data.documentModel.compatSettings.push(compatSettings);
this.processSetting(reader, compatSettings);
}
processSetting(reader, prop) {
if (prop.name == "compatibilityMode")
this.data.documentModel.compatibilitySettings.compatibilityMode = this.data.readerHelper.getWpSTIntegerValue(reader, "val", CompatibilityMode.Word2007);
}
}