UNPKG

devexpress-richedit

Version:

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

23 lines (22 loc) 1.07 kB
import { StringUtils } from '@devexpress/utils/lib/utils/string'; import { ImportBookmarkInfo } from '../../model/import-bookmark-info'; import { LeafElementDestination } from '../destination'; export class BookmarkElementDestination extends LeafElementDestination { async processElementOpen(reader) { let id = reader.getAttributeNS('id', this.data.constants.wordProcessingNamespaceConst); if (id != null) id = StringUtils.trim(id); if (StringUtils.isNullOrEmpty(id)) return; let name = reader.getAttributeNS('name', this.data.constants.wordProcessingNamespaceConst); if (!StringUtils.isNullOrEmpty(name)) name = StringUtils.trim(name); let bookmark = this.data.subDocumentInfo.bookmarkImporter.bookmarks[id]; if (!bookmark) { bookmark = new ImportBookmarkInfo(); bookmark.name = name; this.data.subDocumentInfo.bookmarkImporter.bookmarks[id] = bookmark; } this.assignBookmarkPosition(bookmark); } }