qms-angular 1.0.70 → 1.0.74
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bundles/qms-angular.umd.js +2010 -606
- package/bundles/qms-angular.umd.js.map +1 -1
- package/esm2015/lib/components/button/button.js +2 -2
- package/esm2015/lib/components/qms-navigation-drawer/qms-navigation-drawer.component.js +5 -3
- package/esm2015/lib/components/qms-navigation-drawer/qms-navigation-drawer.module.js +4 -4
- package/esm2015/lib/components/qms-paginator/index.js +2 -0
- package/esm2015/lib/components/qms-paginator/public_api.js +3 -0
- package/esm2015/lib/components/qms-paginator/qms-paginator.component.js +173 -0
- package/esm2015/lib/components/qms-paginator/qms-paginator.module.js +34 -0
- package/esm2015/lib/components/qms-status-dropdown/qms-status-dropdown.component.js +2 -2
- package/esm2015/lib/components/range-slider/directives/range-slider-lockup.directive.js +20 -0
- package/esm2015/lib/components/range-slider/directives/range-slider.directive.js +34 -0
- package/esm2015/lib/components/range-slider/index.js +2 -0
- package/esm2015/lib/components/range-slider/public-api.js +4 -0
- package/esm2015/lib/components/range-slider/range-slider.module.js +22 -0
- package/esm2015/lib/components/related/popup/related-popup.component.js +1 -1
- package/esm2015/lib/components/select-include-children/select-include-children.component.js +112 -45
- package/esm2015/lib/components/select-one/select-one.component.js +50 -3
- package/esm2015/lib/components/side-sheet/directives/drawer-content.directive.js +20 -0
- package/esm2015/lib/components/side-sheet/directives/drawer-header-action.directive.js +20 -0
- package/esm2015/lib/components/side-sheet/directives/drawer-header.directive.js +20 -0
- package/esm2015/lib/components/side-sheet/directives/drawer.directive.js +20 -0
- package/esm2015/lib/components/side-sheet/index.js +2 -0
- package/esm2015/lib/components/side-sheet/public-api.js +6 -0
- package/esm2015/lib/components/side-sheet/side-sheet.module.js +28 -0
- package/esm2015/lib/components/tree/tree.component.js +15 -19
- package/esm2015/lib/components/treeNew/tree.component.js +6 -3
- package/esm2015/lib/directives/table/table-row.directive.js +42 -0
- package/esm2015/lib/directives/table/table.directive.js +13 -60
- package/esm2015/lib/model/en.js +38 -3
- package/esm2015/lib/model/no.js +37 -2
- package/esm2015/lib/qms-angular.module.js +5 -24
- package/esm2015/lib/qms-ckeditor-components/common/bpmn/inspector.function.js +68 -16
- package/esm2015/lib/qms-ckeditor-components/common/classes/qmsUploadAdapter.js +89 -0
- package/esm2015/lib/qms-ckeditor-components/common/constants/ckeditorEvent.constant.js +7 -1
- package/esm2015/lib/qms-ckeditor-components/common/constants/ckeditorFlowchart.const.js +10 -1
- package/esm2015/lib/qms-ckeditor-components/common/constants/ckeditorLink.constant.js +7 -0
- package/esm2015/lib/qms-ckeditor-components/common/enums/document-type.enum.js +2 -1
- package/esm2015/lib/qms-ckeditor-components/common/enums/shape-flow-chart-connection-type.js +8 -0
- package/esm2015/lib/qms-ckeditor-components/common/models/qms-ckeditor-data.model.js +1 -1
- package/esm2015/lib/qms-ckeditor-components/common/models/qms-ckeditor-flowchart-template.model.js +9 -0
- package/esm2015/lib/qms-ckeditor-components/common/models/qms-ckeditor-flowchart.model.js +9 -0
- package/esm2015/lib/qms-ckeditor-components/common/models/qms-ckeditor-save-as-template.model.js +3 -0
- package/esm2015/lib/qms-ckeditor-components/common/models/qms-ckeditor-video-tree.model.js +4 -0
- package/esm2015/lib/qms-ckeditor-components/common/models/wproofreader-config.model.js +6 -0
- package/esm2015/lib/qms-ckeditor-components/common/module/confirm/qms-ckeditor-confirm.component.js +1 -1
- package/esm2015/lib/qms-ckeditor-components/components/qms-ckeditor-about/qms-ckeditor-about.component.js +38 -0
- package/esm2015/lib/qms-ckeditor-components/components/qms-ckeditor-bpmn/qms-ckeditor-bpmn.component.js +564 -34
- package/esm2015/lib/qms-ckeditor-components/components/qms-ckeditor-bpmn/save-template/save-template.component.js +46 -18
- package/esm2015/lib/qms-ckeditor-components/components/qms-ckeditor-fullscreen/qms-ckeditor-fullscreen.component.js +1 -46
- package/esm2015/lib/qms-ckeditor-components/components/qms-ckeditor-imagemap/qms-ckeditor-imagemap.component.js +9 -8
- package/esm2015/lib/qms-ckeditor-components/components/qms-ckeditor-link/attachments/link-attachment.component.js +1 -1
- package/esm2015/lib/qms-ckeditor-components/components/qms-ckeditor-link/qms-ckeditor-link.component.js +5 -2
- package/esm2015/lib/qms-ckeditor-components/components/qms-ckeditor-load-template/qms-ckeditor-load-template.component.js +1 -1
- package/esm2015/lib/qms-ckeditor-components/components/qms-ckeditor-relation/qmsckeditor-related.component.js +1 -1
- package/esm2015/lib/qms-ckeditor-components/components/qms-ckeditor-template/qms-ckeditor-template.component.js +1 -1
- package/esm2015/lib/qms-ckeditor-components/components/qms-ckeditor-tooltip/qms-ckeditor-tooltip.component.js +4 -5
- package/esm2015/lib/qms-ckeditor-components/models/qms-ckeditor-bpmn-data.model.js +8 -0
- package/esm2015/lib/qms-ckeditor-components/qms-ckeditor.component.js +184 -28
- package/esm2015/lib/qms-ckeditor-components/qms-ckeditor.module.js +8 -2
- package/esm2015/lib/qms-ckeditor-components/services/qms-ckeditor-bpmn.service.js +58 -20
- package/esm2015/lib/qms-ckeditor-components/services/qms-ckeditor-flowchart.service.js +26 -0
- package/esm2015/lib/qms-ckeditor-components/services/qms-ckeditor-tree.service.js +4 -1
- package/esm2015/lib/qms-ckeditor-components/services/qms-ckeditor-upload.service.js +20 -0
- package/esm2015/public-api.js +10 -7
- package/esm2015/qms-angular.js +12 -8
- package/fesm2015/qms-angular.js +1900 -572
- package/fesm2015/qms-angular.js.map +1 -1
- package/lib/components/button/button.d.ts +1 -1
- package/lib/components/qms-navigation-drawer/qms-navigation-drawer.component.d.ts +1 -0
- package/lib/components/qms-paginator/index.d.ts +1 -0
- package/lib/components/qms-paginator/public_api.d.ts +2 -0
- package/lib/components/qms-paginator/qms-paginator.component.d.ts +51 -0
- package/lib/components/qms-paginator/qms-paginator.module.d.ts +2 -0
- package/lib/{directives/range-slider → components/range-slider/directives}/range-slider-lockup.directive.d.ts +0 -0
- package/lib/{directives/range-slider → components/range-slider/directives}/range-slider.directive.d.ts +0 -0
- package/lib/components/range-slider/index.d.ts +1 -0
- package/lib/components/range-slider/public-api.d.ts +3 -0
- package/lib/components/range-slider/range-slider.module.d.ts +2 -0
- package/lib/components/select-include-children/select-include-children.component.d.ts +2 -1
- package/lib/components/select-one/select-one.component.d.ts +4 -0
- package/lib/{directives/side-sheet → components/side-sheet/directives}/drawer-content.directive.d.ts +0 -0
- package/lib/{directives/side-sheet → components/side-sheet/directives}/drawer-header-action.directive.d.ts +0 -0
- package/lib/{directives/side-sheet → components/side-sheet/directives}/drawer-header.directive.d.ts +0 -0
- package/lib/{directives/side-sheet → components/side-sheet/directives}/drawer.directive.d.ts +0 -0
- package/lib/components/side-sheet/index.d.ts +1 -0
- package/lib/components/side-sheet/public-api.d.ts +5 -0
- package/lib/components/side-sheet/side-sheet.module.d.ts +2 -0
- package/lib/directives/table/table-row.directive.d.ts +13 -0
- package/lib/directives/table/table.directive.d.ts +1 -11
- package/lib/model/en.d.ts +35 -0
- package/lib/model/no.d.ts +35 -0
- package/lib/qms-ckeditor-components/common/bpmn/inspector.function.d.ts +28 -0
- package/lib/qms-ckeditor-components/common/classes/qmsUploadAdapter.d.ts +18 -0
- package/lib/qms-ckeditor-components/common/constants/ckeditorEvent.constant.d.ts +6 -0
- package/lib/qms-ckeditor-components/common/constants/ckeditorFlowchart.const.d.ts +9 -0
- package/lib/qms-ckeditor-components/common/constants/ckeditorLink.constant.d.ts +6 -0
- package/lib/qms-ckeditor-components/common/enums/document-type.enum.d.ts +1 -0
- package/lib/qms-ckeditor-components/common/enums/shape-flow-chart-connection-type.d.ts +6 -0
- package/lib/qms-ckeditor-components/common/models/qms-ckeditor-data.model.d.ts +5 -0
- package/lib/qms-ckeditor-components/common/models/qms-ckeditor-flowchart-template.model.d.ts +7 -0
- package/lib/qms-ckeditor-components/common/models/qms-ckeditor-flowchart.model.d.ts +7 -0
- package/lib/qms-ckeditor-components/common/models/qms-ckeditor-save-as-template.model.d.ts +5 -0
- package/lib/qms-ckeditor-components/common/models/qms-ckeditor-video-tree.model.d.ts +5 -0
- package/lib/qms-ckeditor-components/common/models/wproofreader-config.model.d.ts +25 -0
- package/lib/qms-ckeditor-components/components/qms-ckeditor-about/qms-ckeditor-about.component.d.ts +15 -0
- package/lib/qms-ckeditor-components/components/qms-ckeditor-bpmn/qms-ckeditor-bpmn.component.d.ts +88 -4
- package/lib/qms-ckeditor-components/components/qms-ckeditor-bpmn/save-template/save-template.component.d.ts +8 -2
- package/lib/qms-ckeditor-components/components/qms-ckeditor-imagemap/qms-ckeditor-imagemap.component.d.ts +2 -1
- package/lib/qms-ckeditor-components/models/qms-ckeditor-bpmn-data.model.d.ts +7 -0
- package/lib/qms-ckeditor-components/qms-ckeditor.component.d.ts +17 -5
- package/lib/qms-ckeditor-components/services/qms-ckeditor-bpmn.service.d.ts +1 -0
- package/lib/qms-ckeditor-components/services/qms-ckeditor-flowchart.service.d.ts +10 -0
- package/lib/qms-ckeditor-components/services/qms-ckeditor-tree.service.d.ts +2 -0
- package/lib/qms-ckeditor-components/services/qms-ckeditor-upload.service.d.ts +5 -0
- package/lib.theme.scss +1 -0
- package/package.json +1 -1
- package/public-api.d.ts +6 -6
- package/qms-angular.d.ts +11 -7
- package/qms-angular.metadata.json +1 -1
- package/src/assets/images/ckeditor5.svg +1 -0
- package/src/assets/jointjs/js/rappid.js +55919 -55836
- package/src/assets/jointjs/scss/bpmn.scss +2 -1
- package/src/assets/qms-ckeditor-plugin/build/ckeditor.js +1 -1
- package/src/assets/qms-ckeditor-plugin/build/ckeditor.js.map +1 -1
- package/src/assets/qms-ckeditor-plugin/build/translations/az.js +1 -1
- package/src/assets/qms-ckeditor-plugin/build/translations/cs.js +1 -1
- package/src/assets/qms-ckeditor-plugin/build/translations/da.js +1 -1
- package/src/assets/qms-ckeditor-plugin/build/translations/de-ch.js +1 -1
- package/src/assets/qms-ckeditor-plugin/build/translations/de.js +1 -1
- package/src/assets/qms-ckeditor-plugin/build/translations/en-au.js +1 -1
- package/src/assets/qms-ckeditor-plugin/build/translations/es.js +1 -1
- package/src/assets/qms-ckeditor-plugin/build/translations/et.js +1 -1
- package/src/assets/qms-ckeditor-plugin/build/translations/fa.js +1 -1
- package/src/assets/qms-ckeditor-plugin/build/translations/fr.js +1 -1
- package/src/assets/qms-ckeditor-plugin/build/translations/gl.js +1 -1
- package/src/assets/qms-ckeditor-plugin/build/translations/he.js +1 -1
- package/src/assets/qms-ckeditor-plugin/build/translations/hi.js +1 -1
- package/src/assets/qms-ckeditor-plugin/build/translations/hr.js +1 -1
- package/src/assets/qms-ckeditor-plugin/build/translations/hu.js +1 -1
- package/src/assets/qms-ckeditor-plugin/build/translations/id.js +1 -1
- package/src/assets/qms-ckeditor-plugin/build/translations/it.js +1 -1
- package/src/assets/qms-ckeditor-plugin/build/translations/ja.js +1 -1
- package/src/assets/qms-ckeditor-plugin/build/translations/ko.js +1 -1
- package/src/assets/qms-ckeditor-plugin/build/translations/ku.js +1 -1
- package/src/assets/qms-ckeditor-plugin/build/translations/lv.js +1 -1
- package/src/assets/qms-ckeditor-plugin/build/translations/nl.js +1 -1
- package/src/assets/qms-ckeditor-plugin/build/translations/no.js +1 -1
- package/src/assets/qms-ckeditor-plugin/build/translations/pl.js +1 -1
- package/src/assets/qms-ckeditor-plugin/build/translations/pt-br.js +1 -1
- package/src/assets/qms-ckeditor-plugin/build/translations/ru.js +1 -1
- package/src/assets/qms-ckeditor-plugin/build/translations/sk.js +1 -1
- package/src/assets/qms-ckeditor-plugin/build/translations/sl.js +1 -1
- package/src/assets/qms-ckeditor-plugin/build/translations/sr-latn.js +1 -1
- package/src/assets/qms-ckeditor-plugin/build/translations/sr.js +1 -1
- package/src/assets/qms-ckeditor-plugin/build/translations/th.js +1 -1
- package/src/assets/qms-ckeditor-plugin/build/translations/tk.js +1 -1
- package/src/assets/qms-ckeditor-plugin/build/translations/tr.js +1 -1
- package/src/assets/qms-ckeditor-plugin/build/translations/uk.js +1 -1
- package/src/assets/qms-ckeditor-plugin/build/translations/vi.js +1 -1
- package/src/assets/qms-ckeditor-plugin/build/translations/zh-cn.js +1 -1
- package/src/assets/qms-ckeditor-plugin/build/translations/zh.js +1 -1
- package/src/assets/qms-ckeditor-plugin/package-lock.json +23 -0
- package/src/assets/qms-ckeditor-plugin/package.json +2 -0
- package/src/assets/qms-ckeditor-plugin/src/ckeditor.js +18 -4
- package/src/assets/qms-ckeditor-plugin/src/plugins/aboutckeditor/aboutckeditor.js +28 -0
- package/src/assets/qms-ckeditor-plugin/src/plugins/bpmn/bpmndialogcommand.js +74 -0
- package/src/assets/qms-ckeditor-plugin/src/plugins/bpmn/qmsCKEditorBpmnPlugin.js +6 -44
- package/src/assets/qms-ckeditor-plugin/src/plugins/ckeditor5-source-editing/lang/contexts.json +3 -0
- package/src/assets/qms-ckeditor-plugin/src/plugins/ckeditor5-source-editing/lang/translations/de.po +21 -0
- package/src/assets/qms-ckeditor-plugin/src/plugins/ckeditor5-source-editing/lang/translations/en.po +21 -0
- package/src/assets/qms-ckeditor-plugin/src/plugins/ckeditor5-source-editing/lang/translations/gl.po +21 -0
- package/src/assets/qms-ckeditor-plugin/src/plugins/ckeditor5-source-editing/lang/translations/hu.po +21 -0
- package/src/assets/qms-ckeditor-plugin/src/plugins/ckeditor5-source-editing/lang/translations/it.po +21 -0
- package/src/assets/qms-ckeditor-plugin/src/plugins/ckeditor5-source-editing/lang/translations/ru.po +21 -0
- package/src/assets/qms-ckeditor-plugin/src/plugins/ckeditor5-source-editing/lang/translations/zh.po +21 -0
- package/src/assets/qms-ckeditor-plugin/src/plugins/ckeditor5-source-editing/src/index.js +10 -0
- package/src/assets/qms-ckeditor-plugin/src/plugins/ckeditor5-source-editing/src/sourceediting.js +386 -0
- package/src/assets/qms-ckeditor-plugin/src/plugins/ckeditor5-source-editing/src/utils/formathtml.js +142 -0
- package/src/assets/qms-ckeditor-plugin/src/plugins/ckeditor5-source-editing/theme/icons/source-editing.svg +1 -0
- package/src/assets/qms-ckeditor-plugin/src/plugins/ckeditor5-source-editing/theme/sourceediting.css +48 -0
- package/src/assets/qms-ckeditor-plugin/src/plugins/common/qmsCKEditorConstant.js +11 -1
- package/src/assets/qms-ckeditor-plugin/src/plugins/common/qmsCKEditorService.js +21 -0
- package/src/assets/qms-ckeditor-plugin/src/plugins/common/qmsCKEditorUtil.js +29 -7
- package/src/assets/qms-ckeditor-plugin/src/plugins/fullscreen/qmsCKEditorFullscreenPlugin.js +22 -15
- package/src/assets/qms-ckeditor-plugin/src/plugins/imagemap/converters.js +93 -92
- package/src/assets/qms-ckeditor-plugin/src/plugins/imagemap/imagemap.js +4 -4
- package/src/assets/qms-ckeditor-plugin/src/plugins/imagemap/imagemapcommand.js +93 -0
- package/src/assets/qms-ckeditor-plugin/src/plugins/imagemap/imagemapdialogcommand.js +59 -0
- package/src/assets/qms-ckeditor-plugin/src/plugins/imagemap/imagemapediting.js +92 -87
- package/src/assets/qms-ckeditor-plugin/src/plugins/imagemap/imagemapui.js +13 -14
- package/src/assets/qms-ckeditor-plugin/src/plugins/imagemap/resizeimagemapcommand.js +25 -24
- package/src/assets/qms-ckeditor-plugin/src/plugins/imagemap/utils.js +40 -49
- package/src/assets/qms-ckeditor-plugin/src/plugins/link/linkcommand.js +131 -176
- package/src/assets/qms-ckeditor-plugin/src/plugins/link/linkdialogcommand.js +88 -0
- package/src/assets/qms-ckeditor-plugin/src/plugins/link/linkediting.js +2 -0
- package/src/assets/qms-ckeditor-plugin/src/plugins/link/linkui.js +41 -32
- package/src/assets/qms-ckeditor-plugin/src/plugins/tableofcontents/tableofcontents.js +14 -0
- package/src/assets/qms-ckeditor-plugin/src/plugins/tableofcontents/tableofcontentscommand.js +87 -0
- package/src/assets/qms-ckeditor-plugin/src/plugins/tableofcontents/tableofcontentsediting.js +59 -0
- package/src/assets/qms-ckeditor-plugin/src/plugins/tableofcontents/tableofcontentsui.js +35 -0
- package/src/assets/qms-ckeditor-plugin/src/plugins/tableofcontents/utils.js +62 -0
- package/src/assets/qms-ckeditor-plugin/src/plugins/template/loadtemplatedialogcommand.js +14 -0
- package/src/assets/qms-ckeditor-plugin/src/plugins/template/qmsCKEditorLoadTemplatePlugin.js +10 -12
- package/src/assets/qms-ckeditor-plugin/src/plugins/template/qmsCKEdtiorTemplatePlugin.js +10 -7
- package/src/assets/qms-ckeditor-plugin/src/plugins/template/templatedialogcommand.js +9 -0
- package/src/assets/qms-ckeditor-plugin/src/plugins/timestamp/timestamp.js +15 -18
- package/src/assets/qms-ckeditor-plugin/src/plugins/timestamp/timestampcommand.js +17 -0
- package/src/assets/qms-ckeditor-plugin/src/plugins/tooltip/removetooltipcommand.js +42 -26
- package/src/assets/qms-ckeditor-plugin/src/plugins/tooltip/tooltip.js +3 -3
- package/src/assets/qms-ckeditor-plugin/src/plugins/tooltip/tooltipcommand.js +75 -0
- package/src/assets/qms-ckeditor-plugin/src/plugins/tooltip/tooltipdialogcommand.js +68 -0
- package/src/assets/qms-ckeditor-plugin/src/plugins/tooltip/tooltipediting.js +206 -131
- package/src/assets/qms-ckeditor-plugin/src/plugins/tooltip/tooltipui.js +424 -136
- package/src/assets/qms-ckeditor-plugin/src/plugins/tooltip/ui/actionsview.js +67 -12
- package/src/assets/qms-ckeditor-plugin/src/plugins/tooltip/utils.js +17 -55
- package/src/assets/qms-ckeditor-plugin/src/plugins/video/autovideo.js +1 -5
- package/src/assets/qms-ckeditor-plugin/src/plugins/video/video/videoediting.js +5 -2
- package/src/assets/qms-ckeditor-plugin/src/plugins/video/videoupload/browsevideodialogcommand.js +25 -0
- package/src/assets/qms-ckeditor-plugin/src/plugins/video/videoupload/uploadvideocommand.js +3 -16
- package/src/assets/qms-ckeditor-plugin/src/plugins/video/videoupload/videouploadediting.js +4 -0
- package/src/assets/qms-ckeditor-plugin/src/plugins/video/videoupload/videouploadui.js +12 -23
- package/src/assets/qms-ckeditor-plugin/src/themes/icons/fullscreen_exit.svg +1 -0
- package/src/assets/qms-ckeditor-plugin/src/themes/icons/information.svg +1 -50
- package/src/assets/qms-ckeditor-plugin/src/themes/icons/table-excel.svg +44 -0
- package/src/assets/qms-ckeditor-plugin/src/themes/icons/timestamp.svg +1 -1
- package/src/assets/qms-ckeditor-plugin/src/themes/icons/tooltip.svg +1 -0
- package/src/assets/qms-ckeditor-plugin/src/themes/styles/heading.css +54 -0
- package/src/assets/qms-ckeditor-plugin/src/themes/styles/tooltip.css +11 -53
- package/src/lib/components/button/button-icon.scss +5 -1
- package/src/lib/components/qms-navigation-drawer/qms-navigation-drawer.component.scss +36 -22
- package/src/lib/components/qms-paginator/qms-paginator.component.scss +143 -0
- package/src/lib/qms-ckeditor-components/components/qms-ckeditor-about/qms-ckeditor-about.component.scss +16 -0
- package/src/lib/qms-ckeditor-components/components/qms-ckeditor-bpmn/qms-ckeditor-bpmn.component.scss +69 -17
- package/src/lib/qms-ckeditor-components/components/qms-ckeditor-imagemap/qms-ckeditor-imagemap.component.scss +26 -23
- package/src/lib/qms-ckeditor-components/qms-ckeditor.component.scss +24 -0
- package/src/lib/qms-ckeditor-components/styles/_modules.scss +9 -1
- package/src/themes/core/_range-slider.scss +61 -42
- package/src/themes/core/_side-sheet.scss +2 -2
- package/src/themes/core/_table.scss +158 -37
- package/esm2015/lib/directives/range-slider/range-slider-lockup.directive.js +0 -20
- package/esm2015/lib/directives/range-slider/range-slider.directive.js +0 -36
- package/esm2015/lib/directives/side-sheet/drawer-content.directive.js +0 -20
- package/esm2015/lib/directives/side-sheet/drawer-header-action.directive.js +0 -20
- package/esm2015/lib/directives/side-sheet/drawer-header.directive.js +0 -20
- package/esm2015/lib/directives/side-sheet/drawer.directive.js +0 -20
- package/esm2015/lib/qms-ckeditor-components/common/classes/uploadAdapter.js +0 -26
- package/lib/qms-ckeditor-components/common/classes/uploadAdapter.d.ts +0 -5
- package/src/assets/qms-ckeditor-plugin/src/plugins/imagemap/insertimagemapcommand.js +0 -128
- package/src/assets/qms-ckeditor-plugin/src/plugins/tooltip/inserttooltipcommand.js +0 -88
@@ -1,10 +1,11 @@
|
|
1
1
|
import { getViewImgFromWidget } from '@ckeditor/ckeditor5-image/src/image/utils';
|
2
|
-
import {
|
2
|
+
import { IMAGEMAP_ATTRIBUTES, IMAGEMAP_ELEMENTS, HTML_ATTRIBUTES, HTML_ELEMENTS} from './utils';
|
3
3
|
import { first } from '@ckeditor/ckeditor5-utils';
|
4
|
+
import { trimStart } from '../common/qmsCKEditorUtil';
|
4
5
|
|
5
6
|
export function dowcastMapAreaAttribute() {
|
6
7
|
return dispatcher => {
|
7
|
-
dispatcher.on(`attribute:${
|
8
|
+
dispatcher.on(`attribute:${IMAGEMAP_ATTRIBUTES.MAP_AREAS}:${IMAGEMAP_ELEMENTS.MAP}`, (evt, data, conversionApi) => {
|
8
9
|
if (!conversionApi.consumable.consume(data.item, evt.name)) {
|
9
10
|
return;
|
10
11
|
}
|
@@ -23,9 +24,9 @@ export function dowcastMapAreaAttribute() {
|
|
23
24
|
if(!!areas && areas.length > 0){
|
24
25
|
areas.forEach(area => {
|
25
26
|
if(area.coords && area.shape){
|
26
|
-
let areaElement = viewWriter.createEmptyElement(
|
27
|
+
let areaElement = viewWriter.createEmptyElement(HTML_ELEMENTS.AREA, {
|
27
28
|
coords: area.coords,
|
28
|
-
alt: area.alt || '',
|
29
|
+
alt: area.alt || '',
|
29
30
|
shape: area.shape || '',
|
30
31
|
href: area.href,
|
31
32
|
target: area.target
|
@@ -41,7 +42,7 @@ export function dowcastMapAreaAttribute() {
|
|
41
42
|
|
42
43
|
export function dowcastMapNameAttribute() {
|
43
44
|
return dispatcher => {
|
44
|
-
dispatcher.on(`attribute:${
|
45
|
+
dispatcher.on(`attribute:${IMAGEMAP_ATTRIBUTES.MAP_NAME}:${IMAGEMAP_ELEMENTS.MAP}`, (evt, data, conversionApi) => {
|
45
46
|
if (!conversionApi.consumable.consume(data.item, evt.name)) {
|
46
47
|
return;
|
47
48
|
}
|
@@ -50,15 +51,15 @@ export function dowcastMapNameAttribute() {
|
|
50
51
|
if(!mapElement){
|
51
52
|
return;
|
52
53
|
}
|
53
|
-
viewWriter.setAttribute(
|
54
|
-
viewWriter.setAttribute(
|
54
|
+
viewWriter.setAttribute(HTML_ATTRIBUTES.NAME, data.attributeNewValue, mapElement);
|
55
|
+
viewWriter.setAttribute(HTML_ATTRIBUTES.ID, data.attributeNewValue, mapElement);
|
55
56
|
});
|
56
57
|
};
|
57
58
|
}
|
58
59
|
|
59
60
|
export function dowcastMapWidthAttribute() {
|
60
61
|
return dispatcher => {
|
61
|
-
dispatcher.on(`attribute:${
|
62
|
+
dispatcher.on(`attribute:${IMAGEMAP_ATTRIBUTES.MAP_WIDTH}:${IMAGEMAP_ELEMENTS.MAP}`, (evt, data, conversionApi) => {
|
62
63
|
if (!conversionApi.consumable.consume(data.item, evt.name)) {
|
63
64
|
return;
|
64
65
|
}
|
@@ -67,14 +68,14 @@ export function dowcastMapWidthAttribute() {
|
|
67
68
|
if(!mapElement){
|
68
69
|
return;
|
69
70
|
}
|
70
|
-
viewWriter.setAttribute(
|
71
|
+
viewWriter.setAttribute(HTML_ATTRIBUTES.WIDTH, data.attributeNewValue || '', mapElement);
|
71
72
|
});
|
72
73
|
};
|
73
74
|
}
|
74
75
|
|
75
76
|
export function dowcastMapHeightAttribute() {
|
76
77
|
return dispatcher => {
|
77
|
-
dispatcher.on(`attribute:${
|
78
|
+
dispatcher.on(`attribute:${IMAGEMAP_ATTRIBUTES.MAP_HEIGHT}:${IMAGEMAP_ELEMENTS.MAP}`, (evt, data, conversionApi) => {
|
78
79
|
if (!conversionApi.consumable.consume(data.item, evt.name)) {
|
79
80
|
return;
|
80
81
|
}
|
@@ -83,20 +84,20 @@ export function dowcastMapHeightAttribute() {
|
|
83
84
|
if(!mapElement){
|
84
85
|
return;
|
85
86
|
}
|
86
|
-
viewWriter.setAttribute(
|
87
|
+
viewWriter.setAttribute(HTML_ATTRIBUTES.HEIGHT, data.attributeNewValue || '', mapElement);
|
87
88
|
});
|
88
89
|
};
|
89
90
|
}
|
90
91
|
|
91
92
|
export function downcastMapElement() {
|
92
93
|
return dispatcher => {
|
93
|
-
dispatcher.on(`insert:${
|
94
|
+
dispatcher.on(`insert:${IMAGEMAP_ELEMENTS.MAP}`, (evt, data, conversionApi)=> {
|
94
95
|
const { consumable, writer, mapper} = conversionApi;
|
95
96
|
if (!consumable.consume(data.item, 'insert')) {
|
96
97
|
return;
|
97
98
|
}
|
98
99
|
const viewPosition = mapper.toViewPosition(data.range.start);
|
99
|
-
const viewElement = writer.createContainerElement(
|
100
|
+
const viewElement = writer.createContainerElement(HTML_ELEMENTS.MAP);
|
100
101
|
mapper.bindElements(data.item, viewElement);
|
101
102
|
writer.insert(viewPosition, viewElement );
|
102
103
|
});
|
@@ -105,132 +106,132 @@ export function downcastMapElement() {
|
|
105
106
|
|
106
107
|
export function downcastImageWidthAttribute() {
|
107
108
|
return dispatcher => {
|
108
|
-
dispatcher.on(`attribute:${
|
109
|
+
dispatcher.on(`attribute:${IMAGEMAP_ATTRIBUTES.IMAGE_WIDTH}:${IMAGEMAP_ELEMENTS.IMAGE}`, (evt, data, conversionApi) => {
|
109
110
|
if (!conversionApi.consumable.consume(data.item, evt.name)) {
|
110
111
|
return;
|
111
112
|
}
|
112
113
|
const viewWriter = conversionApi.writer;
|
113
114
|
const figure = conversionApi.mapper.toViewElement(data.item);
|
114
115
|
const img = getViewImgFromWidget(figure);
|
115
|
-
viewWriter.setAttribute(
|
116
|
+
viewWriter.setAttribute(HTML_ATTRIBUTES.WIDTH, data.attributeNewValue, img);
|
116
117
|
});
|
117
118
|
};
|
118
119
|
}
|
119
|
-
|
120
|
+
|
120
121
|
|
121
122
|
export function downcastImageHeightAttribute() {
|
122
123
|
return dispatcher => {
|
123
|
-
dispatcher.on(`attribute:${
|
124
|
+
dispatcher.on(`attribute:${IMAGEMAP_ATTRIBUTES.IMAGE_HEIGHT}:${IMAGEMAP_ELEMENTS.IMAGE}`, (evt, data, conversionApi) => {
|
124
125
|
if (!conversionApi.consumable.consume(data.item, evt.name)) {
|
125
126
|
return;
|
126
127
|
}
|
127
128
|
const viewWriter = conversionApi.writer;
|
128
129
|
const figure = conversionApi.mapper.toViewElement(data.item);
|
129
130
|
const img = getViewImgFromWidget(figure);
|
130
|
-
viewWriter.setAttribute(
|
131
|
+
viewWriter.setAttribute(HTML_ATTRIBUTES.HEIGHT, data.attributeNewValue, img);
|
131
132
|
});
|
132
133
|
};
|
133
134
|
}
|
134
135
|
|
135
|
-
|
136
|
+
|
136
137
|
export function downcastImageSavedSrcAttribute(isDataDowncast) {
|
137
138
|
const priority = isDataDowncast ? 'highest' : 'normal';
|
138
139
|
return dispatcher => {
|
139
|
-
dispatcher.on(`attribute:${
|
140
|
+
dispatcher.on(`attribute:${IMAGEMAP_ATTRIBUTES.IMAGE_SAVED_SRC}:${IMAGEMAP_ELEMENTS.IMAGE}`, (evt, data, conversionApi) => {
|
140
141
|
if (!conversionApi.consumable.consume(data.item, evt.name)) {
|
141
142
|
return;
|
142
143
|
}
|
143
|
-
|
144
|
+
|
144
145
|
const viewWriter = conversionApi.writer;
|
145
146
|
const figure = conversionApi.mapper.toViewElement(data.item);
|
146
147
|
const img = getViewImgFromWidget(figure);
|
147
|
-
|
148
|
+
|
148
149
|
if(isDataDowncast == true){
|
149
150
|
if(data.item.hasAttribute(data.attributeKey)){
|
150
151
|
const originalSrc = data.item.getAttribute(data.attributeKey);
|
151
|
-
viewWriter.setAttribute(
|
152
|
+
viewWriter.setAttribute(HTML_ATTRIBUTES.SRC, originalSrc, img);
|
152
153
|
}
|
153
154
|
}
|
154
155
|
else {
|
155
|
-
viewWriter.setAttribute(
|
156
|
-
}
|
157
|
-
},
|
156
|
+
viewWriter.setAttribute(HTML_ATTRIBUTES.SAVED_SRC, data.attributeNewValue || '', img);
|
157
|
+
}
|
158
|
+
},
|
158
159
|
{
|
159
|
-
priority: priority
|
160
|
+
priority: priority
|
160
161
|
});
|
161
162
|
};
|
162
163
|
}
|
163
|
-
|
164
|
+
|
164
165
|
export function downcastImageMapAttribute() {
|
165
166
|
return dispatcher => {
|
166
|
-
dispatcher.on(`attribute:${
|
167
|
+
dispatcher.on(`attribute:${IMAGEMAP_ATTRIBUTES.IMAGE_USE_MAP}:${IMAGEMAP_ELEMENTS.IMAGE}`, (evt, data, conversionApi)=> {
|
167
168
|
if (!conversionApi.consumable.consume(data.item, evt.name)) {
|
168
169
|
return;
|
169
170
|
}
|
170
|
-
|
171
|
+
|
171
172
|
const viewWriter = conversionApi.writer;
|
172
173
|
const figure = conversionApi.mapper.toViewElement(data.item);
|
173
174
|
const img = getViewImgFromWidget(figure);
|
174
|
-
|
175
|
+
|
175
176
|
const newValue = data.attributeNewValue || '';
|
176
177
|
const oldValue = data.attributeOldValue || '';
|
177
|
-
|
178
|
+
|
178
179
|
if(!!newValue){
|
179
|
-
viewWriter.setAttribute(
|
180
|
+
viewWriter.setAttribute(HTML_ATTRIBUTES.USE_MAP, data.attributeNewValue, img);
|
180
181
|
} else if(!!oldValue){
|
181
|
-
viewWriter.removeAttribute(
|
182
|
+
viewWriter.removeAttribute(HTML_ATTRIBUTES.USE_MAP, img);
|
182
183
|
}
|
183
184
|
});
|
184
185
|
};
|
185
186
|
}
|
186
|
-
|
187
|
+
|
187
188
|
export function upcastMapElement() {
|
188
189
|
return dispatcher => {
|
189
|
-
dispatcher.on(`element:${
|
190
|
+
dispatcher.on(`element:${HTML_ELEMENTS.MAP}`, (evt, data, conversionApi) => {
|
190
191
|
const viewMap = data.viewItem;
|
191
192
|
const currentPosition = data.modelCursor;
|
192
193
|
const modelWriter = conversionApi.writer;
|
193
|
-
|
194
|
+
|
194
195
|
// Do not convert if this is not an map.
|
195
196
|
if (!conversionApi.consumable.test(data.viewItem, {name: true})) {
|
196
197
|
return;
|
197
198
|
}
|
198
|
-
|
199
|
-
const name = viewMap.getAttribute(
|
199
|
+
|
200
|
+
const name = viewMap.getAttribute(HTML_ATTRIBUTES.NAME);
|
200
201
|
// Do not convert if image element is missing 'name' attribute.
|
201
202
|
if (!name) {
|
202
|
-
return;
|
203
|
+
return;
|
203
204
|
}
|
204
205
|
|
205
206
|
const areas = [];
|
206
207
|
if(viewMap.childCount > 0){
|
207
208
|
for (const child of Array.from(viewMap.getChildren())) {
|
208
209
|
let area = {};
|
209
|
-
area[
|
210
|
-
area[
|
211
|
-
area[
|
212
|
-
area[
|
213
|
-
area[
|
210
|
+
area[HTML_ATTRIBUTES.COORDS] = child.getAttribute(HTML_ATTRIBUTES.COORDS);
|
211
|
+
area[HTML_ATTRIBUTES.HREF] = child.getAttribute(HTML_ATTRIBUTES.HREF);
|
212
|
+
area[HTML_ATTRIBUTES.ALT] = child.getAttribute(HTML_ATTRIBUTES.ALT) || '';
|
213
|
+
area[HTML_ATTRIBUTES.SHAPE] = child.getAttribute(HTML_ATTRIBUTES.SHAPE) || '';
|
214
|
+
area[HTML_ATTRIBUTES.TARGET] = child.getAttribute(HTML_ATTRIBUTES.TARGET);
|
214
215
|
areas.push(area);
|
215
216
|
}
|
216
217
|
}
|
217
|
-
|
218
|
-
const width = viewMap.getAttribute(
|
219
|
-
const height = viewMap.getAttribute(
|
218
|
+
|
219
|
+
const width = viewMap.getAttribute(HTML_ATTRIBUTES.WIDTH);
|
220
|
+
const height = viewMap.getAttribute(HTML_ATTRIBUTES.HEIGHT);
|
220
221
|
let attrs = {};
|
221
|
-
attrs[
|
222
|
-
attrs[
|
223
|
-
attrs[
|
224
|
-
attrs[
|
225
|
-
const modelMap = modelWriter.createElement(
|
226
|
-
|
222
|
+
attrs[IMAGEMAP_ATTRIBUTES.MAP_NAME] = name;
|
223
|
+
attrs[IMAGEMAP_ATTRIBUTES.MAP_AREAS] = JSON.stringify(areas);
|
224
|
+
attrs[IMAGEMAP_ATTRIBUTES.MAP_WIDTH] = width;
|
225
|
+
attrs[IMAGEMAP_ATTRIBUTES.MAP_HEIGHT] = height;
|
226
|
+
const modelMap = modelWriter.createElement(IMAGEMAP_ELEMENTS.MAP, attrs);
|
227
|
+
|
227
228
|
//TODO: Insert map element as a direct child of root
|
228
229
|
modelWriter.insert(modelMap, currentPosition);
|
229
230
|
conversionApi.convertChildren(viewMap, modelMap);
|
230
231
|
conversionApi.updateConversionResult(modelMap, data);
|
231
|
-
},
|
232
|
+
},
|
232
233
|
{
|
233
|
-
priority: 'high'
|
234
|
+
priority: 'high'
|
234
235
|
});
|
235
236
|
};
|
236
237
|
}
|
@@ -238,16 +239,16 @@ export function upcastMapElement() {
|
|
238
239
|
|
239
240
|
export function upcastImageMapAttribute() {
|
240
241
|
return dispatcher => {
|
241
|
-
dispatcher.on(`element:${
|
242
|
+
dispatcher.on(`element:${HTML_ELEMENTS.IMAGE}`, (evt, data, conversionApi) => {
|
242
243
|
const {consumable, writer} = conversionApi;
|
243
244
|
const viewImage = data.viewItem;
|
244
|
-
|
245
|
+
|
245
246
|
// Do not convert if the `usemap` attribute was already converted.
|
246
|
-
if (!consumable.consume(viewImage, {attributes: [
|
247
|
+
if (!consumable.consume(viewImage, {attributes: [HTML_ATTRIBUTES.USE_MAP]})) {
|
247
248
|
return;
|
248
249
|
}
|
249
250
|
|
250
|
-
const usemap = viewImage.getAttribute(
|
251
|
+
const usemap = viewImage.getAttribute(HTML_ATTRIBUTES.USE_MAP);
|
251
252
|
// Do not convert if image element is missing `usemap` attribute
|
252
253
|
if (!usemap) {
|
253
254
|
return;
|
@@ -259,31 +260,31 @@ export function upcastImageMapAttribute() {
|
|
259
260
|
return;
|
260
261
|
}
|
261
262
|
|
262
|
-
if (modelImage.is('element',
|
263
|
+
if (modelImage.is('element', IMAGEMAP_ELEMENTS.IMAGE)) {
|
263
264
|
const mapName = trimStart(usemap, '#');
|
264
|
-
writer.setAttribute(
|
265
|
+
writer.setAttribute(IMAGEMAP_ATTRIBUTES.IMAGE_USE_MAP, '#' + mapName, modelImage);
|
265
266
|
}
|
266
|
-
},
|
267
|
+
},
|
267
268
|
{
|
268
269
|
priority: 'low'
|
269
270
|
});
|
270
271
|
};
|
271
272
|
}
|
272
|
-
|
273
|
+
|
273
274
|
|
274
275
|
export function upcastImageSavedSrcAttribute() {
|
275
276
|
return dispatcher => {
|
276
|
-
dispatcher.on(`element:${
|
277
|
+
dispatcher.on(`element:${HTML_ELEMENTS.IMAGE}`, (evt, data, conversionApi) => {
|
277
278
|
const {consumable, writer} = conversionApi;
|
278
279
|
const viewImage = data.viewItem;
|
279
|
-
|
280
|
+
|
280
281
|
// Do not convert if the `usemap` attribute was already converted.
|
281
|
-
if (!consumable.consume(viewImage, {attributes: [
|
282
|
+
if (!consumable.consume(viewImage, {attributes: [HTML_ATTRIBUTES.SAVED_SRC]})) {
|
282
283
|
return;
|
283
284
|
}
|
284
285
|
|
285
|
-
const originalSrc = viewImage.getAttribute(
|
286
|
-
|
286
|
+
const originalSrc = viewImage.getAttribute(HTML_ATTRIBUTES.SAVED_SRC);
|
287
|
+
|
287
288
|
// Do not convert if image element is missing `usemap` attribute
|
288
289
|
if (!originalSrc) {
|
289
290
|
return;
|
@@ -295,13 +296,13 @@ export function upcastImageSavedSrcAttribute() {
|
|
295
296
|
return;
|
296
297
|
}
|
297
298
|
|
298
|
-
if (modelImage.is('element',
|
299
|
-
writer.setAttribute(
|
299
|
+
if (modelImage.is('element', IMAGEMAP_ELEMENTS.IMAGE)) {
|
300
|
+
writer.setAttribute(IMAGEMAP_ATTRIBUTES.IMAGE_SAVED_SRC, originalSrc || '', modelImage);
|
300
301
|
}
|
301
|
-
|
302
|
-
},
|
303
|
-
{
|
304
|
-
priority: 'low'
|
302
|
+
|
303
|
+
},
|
304
|
+
{
|
305
|
+
priority: 'low'
|
305
306
|
});
|
306
307
|
};
|
307
308
|
}
|
@@ -309,17 +310,17 @@ export function upcastImageSavedSrcAttribute() {
|
|
309
310
|
|
310
311
|
export function upcastImageWidthAttribute() {
|
311
312
|
return dispatcher => {
|
312
|
-
dispatcher.on(`element:${
|
313
|
+
dispatcher.on(`element:${HTML_ELEMENTS.IMAGE}`, (evt, data, conversionApi) => {
|
313
314
|
const {consumable, writer} = conversionApi;
|
314
315
|
const viewImage = data.viewItem;
|
315
|
-
|
316
|
+
|
316
317
|
// Do not convert if the `usemap` attribute was already converted.
|
317
|
-
if (!consumable.consume(viewImage, {attributes: [
|
318
|
+
if (!consumable.consume(viewImage, {attributes: [HTML_ATTRIBUTES.WIDTH]})) {
|
318
319
|
return;
|
319
320
|
}
|
320
321
|
|
321
|
-
const width = viewImage.getAttribute(
|
322
|
-
|
322
|
+
const width = viewImage.getAttribute(HTML_ATTRIBUTES.WIDTH);
|
323
|
+
|
323
324
|
// Do not convert if image element is missing `usemap` attribute
|
324
325
|
if (!width) {
|
325
326
|
return;
|
@@ -331,31 +332,31 @@ export function upcastImageWidthAttribute() {
|
|
331
332
|
return;
|
332
333
|
}
|
333
334
|
|
334
|
-
if (modelImage.is('element',
|
335
|
-
writer.setAttribute(
|
335
|
+
if (modelImage.is('element', IMAGEMAP_ELEMENTS.IMAGE)) {
|
336
|
+
writer.setAttribute(IMAGEMAP_ATTRIBUTES.IMAGE_WIDTH, width, modelImage);
|
336
337
|
}
|
337
|
-
},
|
338
|
+
},
|
338
339
|
{
|
339
340
|
priority: 'low'
|
340
341
|
});
|
341
342
|
};
|
342
343
|
}
|
343
|
-
|
344
|
+
|
344
345
|
|
345
346
|
|
346
347
|
export function upcastImageHeightAttribute() {
|
347
348
|
return dispatcher => {
|
348
|
-
dispatcher.on(`element:${
|
349
|
+
dispatcher.on(`element:${HTML_ELEMENTS.IMAGE}`, (evt, data, conversionApi) => {
|
349
350
|
const {consumable, writer} = conversionApi;
|
350
351
|
const viewImage = data.viewItem;
|
351
|
-
|
352
|
+
|
352
353
|
// Do not convert if the `usemap` attribute was already converted.
|
353
|
-
if (!consumable.consume(viewImage, {attributes: [
|
354
|
+
if (!consumable.consume(viewImage, {attributes: [HTML_ATTRIBUTES.HEIGHT]})) {
|
354
355
|
return;
|
355
356
|
}
|
356
357
|
|
357
|
-
const height = viewImage.getAttribute(
|
358
|
-
|
358
|
+
const height = viewImage.getAttribute(HTML_ATTRIBUTES.HEIGHT);
|
359
|
+
|
359
360
|
// Do not convert if image element is missing `usemap` attribute
|
360
361
|
if (!height) {
|
361
362
|
return;
|
@@ -367,10 +368,10 @@ export function upcastImageHeightAttribute() {
|
|
367
368
|
return;
|
368
369
|
}
|
369
370
|
|
370
|
-
if (modelImage.is('element',
|
371
|
-
writer.setAttribute(
|
371
|
+
if (modelImage.is('element', IMAGEMAP_ELEMENTS.IMAGE)) {
|
372
|
+
writer.setAttribute(IMAGEMAP_ATTRIBUTES.IMAGE_HEIGHT, height, modelImage);
|
372
373
|
}
|
373
|
-
},
|
374
|
+
},
|
374
375
|
{
|
375
376
|
priority: 'low'
|
376
377
|
});
|
@@ -1,14 +1,14 @@
|
|
1
1
|
import { Plugin } from '@ckeditor/ckeditor5-core';
|
2
2
|
import ImageMapEditing from './imagemapediting';
|
3
3
|
import ImageMapUI from './imagemapui';
|
4
|
-
|
4
|
+
|
5
5
|
export default class ImageMap extends Plugin {
|
6
|
-
|
6
|
+
|
7
7
|
static get requires() {
|
8
8
|
return [ ImageMapEditing, ImageMapUI ];
|
9
9
|
}
|
10
|
-
|
10
|
+
|
11
11
|
static pluginName() {
|
12
12
|
return 'ImageMap';
|
13
13
|
}
|
14
|
-
}
|
14
|
+
}
|
@@ -0,0 +1,93 @@
|
|
1
|
+
|
2
|
+
import { Command } from '@ckeditor/ckeditor5-core';
|
3
|
+
import { isImage } from '@ckeditor/ckeditor5-image/src/image/utils';
|
4
|
+
import { IMAGEMAP_ATTRIBUTES, IMAGEMAP_ELEMENTS, findMapNodes, drawMap, createInsertedEvent, createRemovedEvent } from './utils';
|
5
|
+
import { trimStart } from '../common/qmsCKEditorUtil';
|
6
|
+
|
7
|
+
export default class ImageMapCommand extends Command {
|
8
|
+
// refresh() {
|
9
|
+
// const element = this.editor.model.document.selection.getSelectedElement();
|
10
|
+
// this.isEnabled = isImage(element);
|
11
|
+
// }
|
12
|
+
|
13
|
+
execute(options) {
|
14
|
+
const editor = this.editor;
|
15
|
+
const model = editor.model;
|
16
|
+
model.change(writer => {
|
17
|
+
var newName = trimStart(options.name, '#');
|
18
|
+
const areas = options.areas;
|
19
|
+
const width = options.imageWidth;
|
20
|
+
const height = options.imageHeight;
|
21
|
+
const imageElement = model.document.selection.getSelectedElement();
|
22
|
+
if(!imageElement | !isImage(imageElement)){
|
23
|
+
return;
|
24
|
+
}
|
25
|
+
const oldName = imageElement.getAttribute(IMAGEMAP_ATTRIBUTES.IMAGE_USE_MAP) || options.oldName;
|
26
|
+
|
27
|
+
if(!!oldName){
|
28
|
+
const range = model.createRangeIn(model.document.getRoot());
|
29
|
+
const existingMapElements = findMapNodes([trimStart(oldName, '#')], range);
|
30
|
+
if(existingMapElements && existingMapElements.length > 0){
|
31
|
+
existingMapElements.forEach(element => {
|
32
|
+
writer.remove(element);
|
33
|
+
});
|
34
|
+
}
|
35
|
+
}
|
36
|
+
|
37
|
+
if(!!areas && areas.length > 0)
|
38
|
+
{
|
39
|
+
writer.setAttribute(IMAGEMAP_ATTRIBUTES.IMAGE_USE_MAP, '#' + newName, imageElement);
|
40
|
+
writer.setAttribute(IMAGEMAP_ATTRIBUTES.IMAGE_WIDTH, width, imageElement);
|
41
|
+
writer.setAttribute(IMAGEMAP_ATTRIBUTES.IMAGE_HEIGHT, height, imageElement);
|
42
|
+
|
43
|
+
let originalImageSrc = imageElement.getAttribute(IMAGEMAP_ATTRIBUTES.IMAGE_SRC);
|
44
|
+
if(!imageElement.hasAttribute(IMAGEMAP_ATTRIBUTES.IMAGE_SAVED_SRC) || !imageElement.getAttribute(IMAGEMAP_ATTRIBUTES.IMAGE_SAVED_SRC)){
|
45
|
+
writer.setAttribute(IMAGEMAP_ATTRIBUTES.IMAGE_SAVED_SRC, originalImageSrc, imageElement);
|
46
|
+
}
|
47
|
+
else{
|
48
|
+
originalImageSrc = imageElement.getAttribute(IMAGEMAP_ATTRIBUTES.IMAGE_SAVED_SRC);
|
49
|
+
}
|
50
|
+
|
51
|
+
let attrs = {};
|
52
|
+
attrs[IMAGEMAP_ATTRIBUTES.MAP_NAME] = newName;
|
53
|
+
attrs[IMAGEMAP_ATTRIBUTES.MAP_AREAS] = JSON.stringify(areas);
|
54
|
+
attrs[IMAGEMAP_ATTRIBUTES.MAP_WIDTH] = width;
|
55
|
+
attrs[IMAGEMAP_ATTRIBUTES.MAP_HEIGHT] = height;
|
56
|
+
const mapElement = writer.createElement(IMAGEMAP_ELEMENTS.MAP, attrs);
|
57
|
+
|
58
|
+
writer.insert(mapElement, writer.createPositionAt(imageElement, "after"));
|
59
|
+
|
60
|
+
drawMap(originalImageSrc, width, height, areas, (oldsrc, newsrc) =>{
|
61
|
+
model.enqueueChange(writer.batch, writer => {
|
62
|
+
writer.setAttribute(IMAGEMAP_ATTRIBUTES.IMAGE_SRC, newsrc, imageElement);
|
63
|
+
this.fire(createInsertedEvent(newName));
|
64
|
+
});
|
65
|
+
});
|
66
|
+
}
|
67
|
+
else {
|
68
|
+
if(imageElement.hasAttribute(IMAGEMAP_ATTRIBUTES.IMAGE_USE_MAP)){
|
69
|
+
writer.removeAttribute(IMAGEMAP_ATTRIBUTES.IMAGE_USE_MAP, imageElement);
|
70
|
+
}
|
71
|
+
|
72
|
+
if(imageElement.hasAttribute(IMAGEMAP_ATTRIBUTES.IMAGE_SAVED_SRC)){
|
73
|
+
|
74
|
+
let src = imageElement.getAttribute(IMAGEMAP_ATTRIBUTES.IMAGE_SAVED_SRC);
|
75
|
+
if(!!src){
|
76
|
+
writer.setAttribute(IMAGEMAP_ATTRIBUTES.IMAGE_SRC, src, imageElement);
|
77
|
+
}
|
78
|
+
writer.removeAttribute(IMAGEMAP_ATTRIBUTES.IMAGE_SAVED_SRC, imageElement);
|
79
|
+
}
|
80
|
+
|
81
|
+
if(imageElement.hasAttribute(IMAGEMAP_ATTRIBUTES.IMAGE_HEIGHT)){
|
82
|
+
writer.removeAttribute(IMAGEMAP_ATTRIBUTES.IMAGE_HEIGHT, imageElement);
|
83
|
+
}
|
84
|
+
|
85
|
+
if(imageElement.hasAttribute(IMAGEMAP_ATTRIBUTES.IMAGE_WIDTH)){
|
86
|
+
writer.removeAttribute(IMAGEMAP_ATTRIBUTES.IMAGE_WIDTH, imageElement);
|
87
|
+
}
|
88
|
+
this.fire(createRemovedEvent(newName));
|
89
|
+
}
|
90
|
+
},{ once: true });
|
91
|
+
}
|
92
|
+
}
|
93
|
+
|
@@ -0,0 +1,59 @@
|
|
1
|
+
|
2
|
+
import { Command } from '@ckeditor/ckeditor5-core';
|
3
|
+
import { isImage } from '@ckeditor/ckeditor5-image/src/image/utils';
|
4
|
+
import * as QMSCKEditorConstant from '../common/qmsCKEditorConstant';
|
5
|
+
import * as QMSCKEditorService from '../common/qmsCKEditorService';
|
6
|
+
import { IMAGEMAP_ATTRIBUTES, IMAGEMAP_COMMANDS, parsePixelToFloat, findFirstMapNode } from './utils';
|
7
|
+
import { getSelectedImageWidget } from '@ckeditor/ckeditor5-image/src/image/utils';
|
8
|
+
import { trimStart } from '../common/qmsCKEditorUtil';
|
9
|
+
|
10
|
+
export default class ImageMapDialogCommand extends Command {
|
11
|
+
|
12
|
+
refresh() {
|
13
|
+
const element = this.editor.model.document.selection.getSelectedElement();
|
14
|
+
this.isEnabled = isImage(element);
|
15
|
+
}
|
16
|
+
|
17
|
+
execute() {
|
18
|
+
const editor = this.editor;
|
19
|
+
const model = editor.model;
|
20
|
+
const view = editor.editing.view;
|
21
|
+
const selectedElement = model.document.selection.getSelectedElement();
|
22
|
+
|
23
|
+
const mapName = selectedElement.getAttribute(IMAGEMAP_ATTRIBUTES.IMAGE_USE_MAP);
|
24
|
+
let originalImageSrc = selectedElement.getAttribute(IMAGEMAP_ATTRIBUTES.IMAGE_SRC);
|
25
|
+
if(selectedElement.hasAttribute(IMAGEMAP_ATTRIBUTES.IMAGE_SAVED_SRC) && selectedElement.getAttribute(IMAGEMAP_ATTRIBUTES.IMAGE_SAVED_SRC)){
|
26
|
+
originalImageSrc = selectedElement.getAttribute(IMAGEMAP_ATTRIBUTES.IMAGE_SAVED_SRC);
|
27
|
+
}
|
28
|
+
|
29
|
+
const data = {'imageUrl': originalImageSrc, 'areas': [], imageWidth: null, imageHeight: null};
|
30
|
+
const imageWidget = getSelectedImageWidget( view.document.selection);
|
31
|
+
const widgetResizePlugin = editor.plugins.get('WidgetResize');
|
32
|
+
const resizer = widgetResizePlugin.getResizerByViewElement( imageWidget );
|
33
|
+
|
34
|
+
if(resizer){
|
35
|
+
const resizerWrapper = resizer._viewResizerWrapper;
|
36
|
+
data.imageWidth = parsePixelToFloat(resizerWrapper.getStyle('width', 0));
|
37
|
+
data.imageHeight = parsePixelToFloat(resizerWrapper.getStyle('height', 0));
|
38
|
+
}
|
39
|
+
|
40
|
+
if(!!mapName){
|
41
|
+
const range = model.createRangeIn(model.document.getRoot());
|
42
|
+
const existingMapElement = findFirstMapNode(trimStart(mapName, '#'), range);
|
43
|
+
if(existingMapElement){
|
44
|
+
data.areas = JSON.parse(existingMapElement.getAttribute(IMAGEMAP_ATTRIBUTES.MAP_AREAS) || []);
|
45
|
+
}
|
46
|
+
}
|
47
|
+
|
48
|
+
QMSCKEditorService.imageMapNotify(data);
|
49
|
+
window[QMSCKEditorConstant.QMSCK_IMAGEMAP_IS_PROCESSING] = false;
|
50
|
+
window.addEventListener(QMSCKEditorConstant.QMSCK_IMAGEMAP_PLUGIN_RESP, (evt) => {
|
51
|
+
if (window[QMSCKEditorConstant.QMSCK_IMAGEMAP_IS_PROCESSING]) {
|
52
|
+
return;
|
53
|
+
}
|
54
|
+
window[QMSCKEditorConstant.QMSCK_IMAGEMAP_IS_PROCESSING] = true;
|
55
|
+
const options = evt.detail;
|
56
|
+
editor.commands.get(IMAGEMAP_COMMANDS.IMAGEMAP).execute(options);
|
57
|
+
}, { once: true});
|
58
|
+
}
|
59
|
+
}
|