UNPKG

devexpress-richedit

Version:

DevExpress Rich Text Editor is an advanced word-processing tool designed for working with rich text documents.

28 lines (27 loc) 1.02 kB
import { ControlOptions } from '../../model/options/control'; import { NumberMapUtils } from '@devexpress/utils/lib/utils/map/number'; import { CommandBase } from '../command-base'; import { IntervalCommandState } from '../command-states'; export class ShowAllFieldCodesCommand extends CommandBase { getState() { return new IntervalCommandState(this.isEnabled(), this.selection.lastSelectedInterval); } isEnabled() { return super.isEnabled() && ControlOptions.isEnabled(this.control.modelManager.richOptions.control.fields); } executeCore(_state, _options) { this.modelManipulator.field.setAllFieldsShowCode(this.baseValue(), NumberMapUtils.toList(this.modelManipulator.model.subDocuments)); return true; } baseValue() { return true; } isEnabledInReadOnlyMode() { return true; } } export class ShowAllFieldResultCommand extends ShowAllFieldCodesCommand { baseValue() { return false; } }