qms-angular 1.0.86 → 1.0.89
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/README.md +5 -1
- package/bundles/qms-angular.umd.js +6943 -219
- package/bundles/qms-angular.umd.js.map +1 -1
- package/esm2015/lib/components/badges/qms-badges.component.js +1 -1
- package/esm2015/lib/components/banner/qms-banner/qms-banner.component.js +1 -1
- package/esm2015/lib/components/banner/qms-banner-confirm/qms-banner-confirm.component.js +1 -1
- package/esm2015/lib/components/banner/qms-banner-loading/qms-banner-loading.component.js +1 -1
- package/esm2015/lib/components/button/button-toggle.js +1 -1
- package/esm2015/lib/components/button/button.js +3 -3
- package/esm2015/lib/components/comment/comment.js +6 -3
- package/esm2015/lib/components/dialog/dialog.js +2 -2
- package/esm2015/lib/components/list/list.js +2 -2
- package/esm2015/lib/components/qms-navigation-drawer/qms-navigation-drawer.component.js +3 -3
- package/esm2015/lib/components/qms-paginator/qms-paginator.component.js +16 -7
- package/esm2015/lib/components/related/content/related-content.component.js +2 -2
- package/esm2015/lib/components/related/list-other-related/list-related.component.js +1 -1
- package/esm2015/lib/components/related/risk/list/list.component.js +1 -1
- package/esm2015/lib/components/related/risk/result/result.component.js +1 -1
- package/esm2015/lib/components/rich-text/rich-text.js +1 -1
- package/esm2015/lib/components/table/table-action.js +2 -2
- package/esm2015/lib/components/table/table.module.js +4 -4
- package/esm2015/lib/components/tooltip/tooltip.js +1 -1
- package/esm2015/lib/components/tree/tree.component.js +1 -1
- package/esm2015/lib/components/treeNew/tree.component.js +18 -2
- package/esm2015/lib/directives/file-upload/file-upload-multiple-selector.directive.js +3 -1
- package/esm2015/lib/directives/file-upload/file-upload-selector.directive.js +3 -1
- package/esm2015/lib/directives/file-upload/file-upload.directive.js +1 -1
- package/esm2015/lib/directives/text-truncate/text-truncate.directive.js +58 -0
- package/esm2015/lib/model/en.js +63 -2
- package/esm2015/lib/model/no.js +63 -2
- package/esm2015/lib/qms-angular.module.js +4 -1
- package/esm2015/lib/qms-ckeditor-components/common/flowchart/config/halo.function.js +87 -0
- package/esm2015/lib/qms-ckeditor-components/common/flowchart/config/inspector.function.js +3767 -0
- package/esm2015/lib/qms-ckeditor-components/common/flowchart/config/selection.function.js +56 -0
- package/esm2015/lib/qms-ckeditor-components/common/flowchart/config/stencil.function.js +1003 -0
- package/esm2015/lib/qms-ckeditor-components/common/flowchart/config/toolbar.function.js +302 -0
- package/esm2015/lib/qms-ckeditor-components/common/flowchart/models/app-shapes.js +320 -0
- package/esm2015/lib/qms-ckeditor-components/common/flowchart/service/keyboard-service.js +69 -0
- package/esm2015/lib/qms-ckeditor-components/common/flowchart/service/kitchensink-service.js +412 -0
- package/esm2015/lib/qms-ckeditor-components/common/flowchart/themes/theme-picker.js +80 -0
- package/esm2015/lib/qms-ckeditor-components/common/functions/common.function.js +34 -1
- package/esm2015/lib/qms-ckeditor-components/common/models/qms-ckeditor-save-as-template.model.js +1 -1
- package/esm2015/lib/qms-ckeditor-components/common/module/confirm/qms-ckeditor-confirm.component.js +3 -3
- package/esm2015/lib/qms-ckeditor-components/components/qms-ckeditor-about/qms-ckeditor-about.component.js +1 -1
- package/esm2015/lib/qms-ckeditor-components/components/qms-ckeditor-bpmn/qms-ckeditor-bpmn.component.js +2 -2
- package/esm2015/lib/qms-ckeditor-components/components/qms-ckeditor-bpmn/save-template/save-template.component.js +2 -2
- package/esm2015/lib/qms-ckeditor-components/components/qms-ckeditor-flowchart/qms-ckeditor-flowchart.component.js +317 -0
- package/esm2015/lib/qms-ckeditor-components/components/qms-ckeditor-imagemap/qms-ckeditor-imagemap.component.js +3 -3
- package/esm2015/lib/qms-ckeditor-components/components/qms-ckeditor-link/attachments/link-attachment.component.js +3 -3
- package/esm2015/lib/qms-ckeditor-components/components/qms-ckeditor-link/qms-ckeditor-link.component.js +3 -3
- package/esm2015/lib/qms-ckeditor-components/components/qms-ckeditor-load-template/qms-ckeditor-load-template.component.js +3 -3
- package/esm2015/lib/qms-ckeditor-components/components/qms-ckeditor-relation/qmsckeditor-related.component.js +3 -3
- package/esm2015/lib/qms-ckeditor-components/components/qms-ckeditor-template/qms-ckeditor-template.component.js +3 -3
- package/esm2015/lib/qms-ckeditor-components/components/qms-ckeditor-tooltip/qms-ckeditor-tooltip.component.js +3 -3
- package/esm2015/lib/qms-ckeditor-components/qms-ckeditor.component.js +35 -3
- package/esm2015/lib/qms-ckeditor-components/qms-ckeditor.module.js +4 -2
- package/esm2015/public-api.js +8 -1
- package/esm2015/qms-angular.js +2 -1
- package/fesm2015/qms-angular.js +6882 -213
- package/fesm2015/qms-angular.js.map +1 -1
- package/lib/components/comment/comment.d.ts +1 -0
- package/lib/components/qms-paginator/qms-paginator.component.d.ts +1 -0
- package/lib/components/treeNew/tree.component.d.ts +1 -0
- package/lib/directives/text-truncate/text-truncate.directive.d.ts +15 -0
- package/lib/model/en.d.ts +61 -0
- package/lib/model/no.d.ts +61 -0
- package/lib/qms-ckeditor-components/common/flowchart/config/halo.function.d.ts +37 -0
- package/lib/qms-ckeditor-components/common/flowchart/config/inspector.function.d.ts +7 -0
- package/lib/qms-ckeditor-components/common/flowchart/config/selection.function.d.ts +39 -0
- package/lib/qms-ckeditor-components/common/flowchart/config/stencil.function.d.ts +11 -0
- package/lib/qms-ckeditor-components/common/flowchart/config/toolbar.function.d.ts +224 -0
- package/lib/qms-ckeditor-components/common/flowchart/models/app-shapes.d.ts +58 -0
- package/lib/qms-ckeditor-components/common/flowchart/service/keyboard-service.d.ts +16 -0
- package/lib/qms-ckeditor-components/common/flowchart/service/kitchensink-service.d.ts +56 -0
- package/lib/qms-ckeditor-components/common/flowchart/themes/theme-picker.d.ts +35 -0
- package/lib/qms-ckeditor-components/common/functions/common.function.d.ts +12 -0
- package/lib/qms-ckeditor-components/common/models/qms-ckeditor-save-as-template.model.d.ts +2 -0
- package/lib/qms-ckeditor-components/components/qms-ckeditor-flowchart/qms-ckeditor-flowchart.component.d.ts +41 -0
- package/lib/qms-ckeditor-components/qms-ckeditor.component.d.ts +4 -0
- package/lib.theme.scss +179 -0
- package/package.json +1 -1
- package/public-api.d.ts +7 -0
- package/qms-angular.d.ts +1 -0
- package/qms-angular.metadata.json +1 -1
- package/src/assets/fonts/Material/flUhRq6tzZclQEJ-Vdg-IuiaDsNc.woff2 +0 -0
- package/src/assets/fonts/Material/gok-H7zzDkdnRel8-DQ6KAXJ69wP1tGnf4ZGhUce.woff2 +0 -0
- package/src/assets/fonts/OpenSans/mem8YaGs126MiZpBA-UFUZ0bbck.woff2 +0 -0
- package/src/assets/fonts/OpenSans/mem8YaGs126MiZpBA-UFVZ0b.woff2 +0 -0
- package/src/assets/fonts/OpenSans/mem8YaGs126MiZpBA-UFVp0bbck.woff2 +0 -0
- package/src/assets/fonts/OpenSans/mem8YaGs126MiZpBA-UFW50bbck.woff2 +0 -0
- package/src/assets/fonts/OpenSans/mem8YaGs126MiZpBA-UFWJ0bbck.woff2 +0 -0
- package/src/assets/fonts/OpenSans/mem8YaGs126MiZpBA-UFWZ0bbck.woff2 +0 -0
- package/src/assets/fonts/OpenSans/mem8YaGs126MiZpBA-UFWp0bbck.woff2 +0 -0
- package/src/assets/fonts/Raleway/1Ptxg8zYS_SKggPN4iEgvnHyvveLxVvaorCFPrEHJA.woff2 +0 -0
- package/src/assets/fonts/Raleway/1Ptxg8zYS_SKggPN4iEgvnHyvveLxVvaorCGPrEHJA.woff2 +0 -0
- package/src/assets/fonts/Raleway/1Ptxg8zYS_SKggPN4iEgvnHyvveLxVvaorCHPrEHJA.woff2 +0 -0
- package/src/assets/fonts/Raleway/1Ptxg8zYS_SKggPN4iEgvnHyvveLxVvaorCIPrE.woff2 +0 -0
- package/src/assets/fonts/Raleway/1Ptxg8zYS_SKggPN4iEgvnHyvveLxVvaorCMPrEHJA.woff2 +0 -0
- package/src/assets/jointjs/images/delete-icon-modern.png +0 -0
- package/src/assets/jointjs/images/reset-icon-modern.png +0 -0
- package/src/assets/jointjs/images/save-icon-modern.png +0 -0
- package/src/assets/jointjs/images/to-front-icon-modern.png +0 -0
- package/src/assets/jointjs/images/toback-icon-modern.png +0 -0
- package/src/assets/jointjs/images/toolbar-icons-material.png +0 -0
- package/src/assets/jointjs/images/toolbar-icons-modern.png +0 -0
- package/src/assets/jointjs/scss/rappid.scss +326 -0
- package/src/assets/jointjs/scss/theme-picker.scss +22 -0
- 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/ar.js +1 -1
- package/src/assets/qms-ckeditor-plugin/build/translations/az.js +1 -1
- package/src/assets/qms-ckeditor-plugin/build/translations/bg.js +1 -1
- package/src/assets/qms-ckeditor-plugin/build/translations/ca.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/el.js +1 -1
- package/src/assets/qms-ckeditor-plugin/build/translations/en-au.js +1 -1
- package/src/assets/qms-ckeditor-plugin/build/translations/en-gb.js +1 -1
- package/src/assets/qms-ckeditor-plugin/build/translations/eo.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/eu.js +1 -1
- package/src/assets/qms-ckeditor-plugin/build/translations/fa.js +1 -1
- package/src/assets/qms-ckeditor-plugin/build/translations/fi.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/km.js +1 -1
- package/src/assets/qms-ckeditor-plugin/build/translations/kn.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/lt.js +1 -1
- package/src/assets/qms-ckeditor-plugin/build/translations/lv.js +1 -1
- package/src/assets/qms-ckeditor-plugin/build/translations/nb.js +1 -1
- package/src/assets/qms-ckeditor-plugin/build/translations/ne.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/pt.js +1 -1
- package/src/assets/qms-ckeditor-plugin/build/translations/ro.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/sq.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/sv.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/ug.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 +12632 -345
- package/src/assets/qms-ckeditor-plugin/package.json +0 -2
- package/src/assets/qms-ckeditor-plugin/src/ckeditor.js +8 -8
- package/src/assets/qms-ckeditor-plugin/src/plugins/common/qmsCKEditorService.js +9 -0
- package/src/assets/qms-ckeditor-plugin/src/plugins/flowchart/flowchartdialogcommand.js +47 -0
- package/src/assets/qms-ckeditor-plugin/src/plugins/flowchart/qmsCKEditorFlowchartPlugin.js +30 -0
- package/src/assets/qms-ckeditor-plugin/src/plugins/heading/heading.js +119 -0
- package/src/assets/qms-ckeditor-plugin/src/plugins/heading/headingbuttonsui.js +103 -0
- package/src/assets/qms-ckeditor-plugin/src/plugins/heading/headingcommand.js +96 -0
- package/src/assets/qms-ckeditor-plugin/src/plugins/heading/headingediting.js +163 -0
- package/src/assets/qms-ckeditor-plugin/src/plugins/heading/headingui.js +115 -0
- package/src/assets/qms-ckeditor-plugin/src/plugins/heading/index.js +22 -0
- package/src/assets/qms-ckeditor-plugin/src/plugins/heading/theme/heading.css +35 -0
- package/src/assets/qms-ckeditor-plugin/src/plugins/heading/theme/icons/heading1.svg +1 -0
- package/src/assets/qms-ckeditor-plugin/src/plugins/heading/theme/icons/heading2.svg +1 -0
- package/src/assets/qms-ckeditor-plugin/src/plugins/heading/theme/icons/heading3.svg +1 -0
- package/src/assets/qms-ckeditor-plugin/src/plugins/heading/theme/icons/heading4.svg +1 -0
- package/src/assets/qms-ckeditor-plugin/src/plugins/heading/theme/icons/heading5.svg +1 -0
- package/src/assets/qms-ckeditor-plugin/src/plugins/heading/theme/icons/heading6.svg +1 -0
- package/src/assets/qms-ckeditor-plugin/src/plugins/heading/title.js +598 -0
- package/src/assets/qms-ckeditor-plugin/src/plugins/heading/utils.js +42 -0
- package/src/assets/qms-ckeditor-plugin/src/plugins/table/commands/insertcolumncommand.js +83 -0
- package/src/assets/qms-ckeditor-plugin/src/plugins/table/commands/insertrowcommand.js +82 -0
- package/src/assets/qms-ckeditor-plugin/src/plugins/table/commands/inserttablecommand.js +76 -0
- package/src/assets/qms-ckeditor-plugin/src/plugins/table/commands/mergecellcommand.js +272 -0
- package/src/assets/qms-ckeditor-plugin/src/plugins/table/commands/mergecellscommand.js +122 -0
- package/src/assets/qms-ckeditor-plugin/src/plugins/table/commands/removecolumncommand.js +122 -0
- package/src/assets/qms-ckeditor-plugin/src/plugins/table/commands/removerowcommand.js +97 -0
- package/src/assets/qms-ckeditor-plugin/src/plugins/table/commands/selectcolumncommand.js +63 -0
- package/src/assets/qms-ckeditor-plugin/src/plugins/table/commands/selectrowcommand.js +56 -0
- package/src/assets/qms-ckeditor-plugin/src/plugins/table/commands/setheadercolumncommand.js +95 -0
- package/src/assets/qms-ckeditor-plugin/src/plugins/table/commands/setheaderrowcommand.js +105 -0
- package/src/assets/qms-ckeditor-plugin/src/plugins/table/commands/splitcellcommand.js +68 -0
- package/src/assets/qms-ckeditor-plugin/src/plugins/table/converters/downcast.js +529 -0
- package/src/assets/qms-ckeditor-plugin/src/plugins/table/converters/table-cell-paragraph-post-fixer.js +136 -0
- package/src/assets/qms-ckeditor-plugin/src/plugins/table/converters/table-cell-refresh-post-fixer.js +75 -0
- package/src/assets/qms-ckeditor-plugin/src/plugins/table/converters/table-heading-rows-refresh-post-fixer.js +55 -0
- package/src/assets/qms-ckeditor-plugin/src/plugins/table/converters/table-layout-post-fixer.js +399 -0
- package/src/assets/qms-ckeditor-plugin/src/plugins/table/converters/tableproperties.js +126 -0
- package/src/assets/qms-ckeditor-plugin/src/plugins/table/converters/upcasttable.js +211 -0
- package/src/assets/qms-ckeditor-plugin/src/plugins/table/index.js +42 -0
- package/src/assets/qms-ckeditor-plugin/src/plugins/table/table.js +103 -0
- package/src/assets/qms-ckeditor-plugin/src/plugins/table/tablecellproperties/commands/tablecellbackgroundcolorcommand.js +35 -0
- package/src/assets/qms-ckeditor-plugin/src/plugins/table/tablecellproperties/commands/tablecellbordercolorcommand.js +47 -0
- package/src/assets/qms-ckeditor-plugin/src/plugins/table/tablecellproperties/commands/tablecellborderstylecommand.js +47 -0
- package/src/assets/qms-ckeditor-plugin/src/plugins/table/tablecellproperties/commands/tablecellborderwidthcommand.js +62 -0
- package/src/assets/qms-ckeditor-plugin/src/plugins/table/tablecellproperties/commands/tablecellheightcommand.js +51 -0
- package/src/assets/qms-ckeditor-plugin/src/plugins/table/tablecellproperties/commands/tablecellhorizontalalignmentcommand.js +35 -0
- package/src/assets/qms-ckeditor-plugin/src/plugins/table/tablecellproperties/commands/tablecellpaddingcommand.js +62 -0
- package/src/assets/qms-ckeditor-plugin/src/plugins/table/tablecellproperties/commands/tablecellpropertycommand.js +110 -0
- package/src/assets/qms-ckeditor-plugin/src/plugins/table/tablecellproperties/commands/tablecellverticalalignmentcommand.js +43 -0
- package/src/assets/qms-ckeditor-plugin/src/plugins/table/tablecellproperties/commands/tablecellwidthcommand.js +51 -0
- package/src/assets/qms-ckeditor-plugin/src/plugins/table/tablecellproperties/tablecellpropertiesediting.js +204 -0
- package/src/assets/qms-ckeditor-plugin/src/plugins/table/tablecellproperties/tablecellpropertiesui.js +401 -0
- package/src/assets/qms-ckeditor-plugin/src/plugins/table/tablecellproperties/ui/tablecellpropertiesview.js +829 -0
- package/src/assets/qms-ckeditor-plugin/src/plugins/table/tablecellproperties.js +80 -0
- package/src/assets/qms-ckeditor-plugin/src/plugins/table/tableclipboard.js +586 -0
- package/src/assets/qms-ckeditor-plugin/src/plugins/table/tableediting.js +160 -0
- package/src/assets/qms-ckeditor-plugin/src/plugins/table/tablekeyboard.js +343 -0
- package/src/assets/qms-ckeditor-plugin/src/plugins/table/tablemouse/mouseeventsobserver.js +72 -0
- package/src/assets/qms-ckeditor-plugin/src/plugins/table/tablemouse.js +218 -0
- package/src/assets/qms-ckeditor-plugin/src/plugins/table/tableproperties/commands/tablealignmentcommand.js +35 -0
- package/src/assets/qms-ckeditor-plugin/src/plugins/table/tableproperties/commands/tablebackgroundcolorcommand.js +35 -0
- package/src/assets/qms-ckeditor-plugin/src/plugins/table/tableproperties/commands/tablebordercolorcommand.js +47 -0
- package/src/assets/qms-ckeditor-plugin/src/plugins/table/tableproperties/commands/tableborderstylecommand.js +47 -0
- package/src/assets/qms-ckeditor-plugin/src/plugins/table/tableproperties/commands/tableborderwidthcommand.js +62 -0
- package/src/assets/qms-ckeditor-plugin/src/plugins/table/tableproperties/commands/tableheightcommand.js +51 -0
- package/src/assets/qms-ckeditor-plugin/src/plugins/table/tableproperties/commands/tablepropertycommand.js +98 -0
- package/src/assets/qms-ckeditor-plugin/src/plugins/table/tableproperties/commands/tablewidthcommand.js +51 -0
- package/src/assets/qms-ckeditor-plugin/src/plugins/table/tableproperties/tablepropertiesediting.js +182 -0
- package/src/assets/qms-ckeditor-plugin/src/plugins/table/tableproperties/tablepropertiesui.js +397 -0
- package/src/assets/qms-ckeditor-plugin/src/plugins/table/tableproperties/ui/tablepropertiesview.js +714 -0
- package/src/assets/qms-ckeditor-plugin/src/plugins/table/tableproperties.js +81 -0
- package/src/assets/qms-ckeditor-plugin/src/plugins/table/tableselection.js +357 -0
- package/src/assets/qms-ckeditor-plugin/src/plugins/table/tabletoolbar.js +111 -0
- package/src/assets/qms-ckeditor-plugin/src/plugins/table/tableui.js +359 -0
- package/src/assets/qms-ckeditor-plugin/src/plugins/table/tableutils.js +909 -0
- package/src/assets/qms-ckeditor-plugin/src/plugins/table/tablewalker.js +538 -0
- package/src/assets/qms-ckeditor-plugin/src/plugins/table/theme/colorinput.css +39 -0
- package/src/assets/qms-ckeditor-plugin/src/plugins/table/theme/form.css +11 -0
- package/src/assets/qms-ckeditor-plugin/src/plugins/table/theme/formrow.css +23 -0
- package/src/assets/qms-ckeditor-plugin/src/plugins/table/theme/icons/table-cell-properties.svg +1 -0
- package/src/assets/qms-ckeditor-plugin/src/plugins/table/theme/icons/table-column.svg +1 -0
- package/src/assets/qms-ckeditor-plugin/src/plugins/table/theme/icons/table-merge-cell.svg +1 -0
- package/src/assets/qms-ckeditor-plugin/src/plugins/table/theme/icons/table-properties.svg +1 -0
- package/src/assets/qms-ckeditor-plugin/src/plugins/table/theme/icons/table-row.svg +1 -0
- package/src/assets/qms-ckeditor-plugin/src/plugins/table/theme/icons/table.svg +1 -0
- package/src/assets/qms-ckeditor-plugin/src/plugins/table/theme/inserttable.css +10 -0
- package/src/assets/qms-ckeditor-plugin/src/plugins/table/theme/snippet.css +3876 -0
- package/src/assets/qms-ckeditor-plugin/src/plugins/table/theme/table.css +67 -0
- package/src/assets/qms-ckeditor-plugin/src/plugins/table/theme/tablecaption.css +53 -0
- package/src/assets/qms-ckeditor-plugin/src/plugins/table/theme/tablecellproperties.css +28 -0
- package/src/assets/qms-ckeditor-plugin/src/plugins/table/theme/tableediting.css +10 -0
- package/src/assets/qms-ckeditor-plugin/src/plugins/table/theme/tableform.css +59 -0
- package/src/assets/qms-ckeditor-plugin/src/plugins/table/theme/tableproperties.css +18 -0
- package/src/assets/qms-ckeditor-plugin/src/plugins/table/theme/tableselection.css +10 -0
- package/src/assets/qms-ckeditor-plugin/src/plugins/table/ui/colorinputview.js +343 -0
- package/src/assets/qms-ckeditor-plugin/src/plugins/table/ui/formrowview.js +103 -0
- package/src/assets/qms-ckeditor-plugin/src/plugins/table/ui/inserttableview.js +222 -0
- package/src/assets/qms-ckeditor-plugin/src/plugins/table/utils/common.js +57 -0
- package/src/assets/qms-ckeditor-plugin/src/plugins/table/utils/selection.js +276 -0
- package/src/assets/qms-ckeditor-plugin/src/plugins/table/utils/structure.js +543 -0
- package/src/assets/qms-ckeditor-plugin/src/plugins/table/utils/table-properties.js +66 -0
- package/src/assets/qms-ckeditor-plugin/src/plugins/table/utils/ui/contextualballoon.js +130 -0
- package/src/assets/qms-ckeditor-plugin/src/plugins/table/utils/ui/table-properties.js +397 -0
- package/src/assets/qms-ckeditor-plugin/src/plugins/table/utils/ui/widget.js +62 -0
- package/src/assets/qms-ckeditor-plugin/src/themes/icons/flowchart.svg +507 -0
- package/src/lib/components/comment/comment.scss +1 -0
- package/src/lib/components/qms-navigation-drawer/qms-navigation-drawer.component.scss +1 -0
- package/src/lib/components/qms-paginator/qms-paginator.component.scss +4 -1
- package/src/lib/qms-ckeditor-components/common/flowchart/assets/image-icon1.svg +1 -0
- package/src/lib/qms-ckeditor-components/common/flowchart/assets/image-icon2.svg +6 -0
- package/src/lib/qms-ckeditor-components/common/flowchart/assets/image-icon3.svg +11 -0
- package/src/lib/qms-ckeditor-components/common/flowchart/assets/image-icon4.svg +8 -0
- package/src/lib/qms-ckeditor-components/common/flowchart/assets/member-female.png +0 -0
- package/src/lib/qms-ckeditor-components/common/flowchart/assets/member-male.png +0 -0
- package/src/lib/qms-ckeditor-components/common/flowchart/assets/no-color-icon.svg +72 -0
- package/src/lib/qms-ckeditor-components/common/flowchart/assets/toolbar-icons-material.png +0 -0
- package/src/lib/qms-ckeditor-components/common/flowchart/assets/toolbar-icons-modern.png +0 -0
- package/src/lib/qms-ckeditor-components/common/flowchart/assets/transparent-icon.svg +50 -0
- package/src/lib/qms-ckeditor-components/components/qms-ckeditor-flowchart/qms-ckeditor-flowchart.component.scss +68 -0
- package/src/lib/qms-ckeditor-components/styles/_modules.scss +9 -0
- package/src/themes/core/_mat-icon.scss +60 -60
- package/src/themes/core/_table.scss +72 -4
- package/src/themes/core/_typography.scss +108 -108
@@ -0,0 +1,529 @@
|
|
1
|
+
/**
|
2
|
+
* @license Copyright (c) 2003-2021, CKSource - Frederico Knabben. All rights reserved.
|
3
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
4
|
+
*/
|
5
|
+
|
6
|
+
/**
|
7
|
+
* @module table/converters/downcast
|
8
|
+
*/
|
9
|
+
|
10
|
+
import TableWalker from './../tablewalker';
|
11
|
+
import { setHighlightHandling, toWidget, toWidgetEditable } from 'ckeditor5/src/widget';
|
12
|
+
import { toArray } from 'ckeditor5/src/utils';
|
13
|
+
|
14
|
+
/**
|
15
|
+
* Model table element to view table element conversion helper.
|
16
|
+
*
|
17
|
+
* This conversion helper creates the whole table element with child elements.
|
18
|
+
*
|
19
|
+
* @param {Object} options
|
20
|
+
* @param {Boolean} options.asWidget If set to `true`, the downcast conversion will produce a widget.
|
21
|
+
* @returns {Function} Conversion helper.
|
22
|
+
*/
|
23
|
+
export function downcastInsertTable( options = {} ) {
|
24
|
+
return dispatcher => dispatcher.on( 'insert:table', ( evt, data, conversionApi ) => {
|
25
|
+
const table = data.item;
|
26
|
+
|
27
|
+
if ( !conversionApi.consumable.consume( table, 'insert' ) ) {
|
28
|
+
return;
|
29
|
+
}
|
30
|
+
|
31
|
+
// Consume attributes if present to not fire attribute change downcast
|
32
|
+
conversionApi.consumable.consume( table, 'attribute:headingRows:table' );
|
33
|
+
conversionApi.consumable.consume( table, 'attribute:headingColumns:table' );
|
34
|
+
|
35
|
+
const asWidget = options && options.asWidget;
|
36
|
+
|
37
|
+
const tableWidth = table.getAttribute('width') || '100%';
|
38
|
+
const tableHeight = table.getAttribute('height') || 'auto';
|
39
|
+
const tableBorder = table.getAttribute( 'border-top' ) || table.getAttribute( 'border-bottom' ) || table.getAttribute( 'border-left' ) || table.getAttribute( 'border-right' ) || '';
|
40
|
+
const borderAttr = tableBorder === '' ? 'border: 1px solid rgb(0, 0, 0)' : null;
|
41
|
+
|
42
|
+
const figureElement = conversionApi.writer.createContainerElement( 'figure', { class: 'table', style: `width: ${tableWidth}; height: ${tableHeight}` } );
|
43
|
+
const tableElement = conversionApi.writer.createContainerElement( 'table', { style: `width: 100%; height: ${tableHeight}; ${borderAttr}` } );
|
44
|
+
|
45
|
+
conversionApi.writer.insert( conversionApi.writer.createPositionAt( figureElement, 0 ), tableElement );
|
46
|
+
|
47
|
+
let tableWidget;
|
48
|
+
|
49
|
+
if ( asWidget ) {
|
50
|
+
tableWidget = toTableWidget( figureElement, conversionApi.writer );
|
51
|
+
}
|
52
|
+
|
53
|
+
const tableWalker = new TableWalker( table );
|
54
|
+
|
55
|
+
const tableAttributes = {
|
56
|
+
headingRows: table.getAttribute( 'headingRows' ) || 0,
|
57
|
+
headingColumns: table.getAttribute( 'headingColumns' ) || 0
|
58
|
+
};
|
59
|
+
|
60
|
+
// Cache for created table rows.
|
61
|
+
const viewRows = new Map();
|
62
|
+
|
63
|
+
for ( const tableSlot of tableWalker ) {
|
64
|
+
const { row, cell } = tableSlot;
|
65
|
+
|
66
|
+
const tableRow = table.getChild( row );
|
67
|
+
const trElement = viewRows.get( row ) || createTr( tableElement, tableRow, row, tableAttributes, conversionApi );
|
68
|
+
viewRows.set( row, trElement );
|
69
|
+
|
70
|
+
// Consume table cell - it will be always consumed as we convert whole table at once.
|
71
|
+
conversionApi.consumable.consume( cell, 'insert' );
|
72
|
+
|
73
|
+
const insertPosition = conversionApi.writer.createPositionAt( trElement, 'end' );
|
74
|
+
|
75
|
+
createViewTableCellElement( tableSlot, tableAttributes, insertPosition, conversionApi, options );
|
76
|
+
}
|
77
|
+
|
78
|
+
// Insert empty TR elements if there are any rows without anchored cells. Since the model is always normalized
|
79
|
+
// this can happen only in the document fragment that only part of the table is down-casted.
|
80
|
+
for ( const tableRow of table.getChildren() ) {
|
81
|
+
const rowIndex = tableRow.index;
|
82
|
+
|
83
|
+
if ( !viewRows.has( rowIndex ) ) {
|
84
|
+
viewRows.set( rowIndex, createTr( tableElement, tableRow, rowIndex, tableAttributes, conversionApi ) );
|
85
|
+
}
|
86
|
+
}
|
87
|
+
|
88
|
+
const viewPosition = conversionApi.mapper.toViewPosition( data.range.start );
|
89
|
+
|
90
|
+
conversionApi.mapper.bindElements( table, asWidget ? tableWidget : figureElement );
|
91
|
+
conversionApi.writer.insert( viewPosition, asWidget ? tableWidget : figureElement );
|
92
|
+
} );
|
93
|
+
}
|
94
|
+
|
95
|
+
/**
|
96
|
+
* Model row element to view `<tr>` element conversion helper.
|
97
|
+
*
|
98
|
+
* This conversion helper creates the whole `<tr>` element with child elements.
|
99
|
+
*
|
100
|
+
* @returns {Function} Conversion helper.
|
101
|
+
*/
|
102
|
+
export function downcastInsertRow() {
|
103
|
+
return dispatcher => dispatcher.on( 'insert:tableRow', ( evt, data, conversionApi ) => {
|
104
|
+
const tableRow = data.item;
|
105
|
+
|
106
|
+
if ( !conversionApi.consumable.consume( tableRow, 'insert' ) ) {
|
107
|
+
return;
|
108
|
+
}
|
109
|
+
|
110
|
+
const table = tableRow.parent;
|
111
|
+
|
112
|
+
const figureElement = conversionApi.mapper.toViewElement( table );
|
113
|
+
const tableElement = getViewTable( figureElement );
|
114
|
+
|
115
|
+
const row = table.getChildIndex( tableRow );
|
116
|
+
|
117
|
+
const tableWalker = new TableWalker( table, { row } );
|
118
|
+
|
119
|
+
const tableAttributes = {
|
120
|
+
headingRows: table.getAttribute( 'headingRows' ) || 0,
|
121
|
+
headingColumns: table.getAttribute( 'headingColumns' ) || 0
|
122
|
+
};
|
123
|
+
|
124
|
+
// Cache for created table rows.
|
125
|
+
const viewRows = new Map();
|
126
|
+
|
127
|
+
for ( const tableSlot of tableWalker ) {
|
128
|
+
const trElement = viewRows.get( row ) || createTr( tableElement, tableRow, row, tableAttributes, conversionApi );
|
129
|
+
viewRows.set( row, trElement );
|
130
|
+
|
131
|
+
// Consume table cell - it will be always consumed as we convert whole row at once.
|
132
|
+
conversionApi.consumable.consume( tableSlot.cell, 'insert' );
|
133
|
+
|
134
|
+
const insertPosition = conversionApi.writer.createPositionAt( trElement, 'end' );
|
135
|
+
|
136
|
+
createViewTableCellElement( tableSlot, tableAttributes, insertPosition, conversionApi, { asWidget: true } );
|
137
|
+
}
|
138
|
+
} );
|
139
|
+
}
|
140
|
+
|
141
|
+
/**
|
142
|
+
* Model table cell element to view `<td>` or `<th>` element conversion helper.
|
143
|
+
*
|
144
|
+
* This conversion helper will create proper `<th>` elements for table cells that are in the heading section (heading row or column)
|
145
|
+
* and `<td>` otherwise.
|
146
|
+
*
|
147
|
+
* @returns {Function} Conversion helper.
|
148
|
+
*/
|
149
|
+
export function downcastInsertCell() {
|
150
|
+
return dispatcher => dispatcher.on( 'insert:tableCell', ( evt, data, conversionApi ) => {
|
151
|
+
const tableCell = data.item;
|
152
|
+
|
153
|
+
if ( !conversionApi.consumable.consume( tableCell, 'insert' ) ) {
|
154
|
+
return;
|
155
|
+
}
|
156
|
+
|
157
|
+
const tableRow = tableCell.parent;
|
158
|
+
const table = tableRow.parent;
|
159
|
+
const rowIndex = table.getChildIndex( tableRow );
|
160
|
+
|
161
|
+
const tableWalker = new TableWalker( table, { row: rowIndex } );
|
162
|
+
|
163
|
+
const tableAttributes = {
|
164
|
+
headingRows: table.getAttribute( 'headingRows' ) || 0,
|
165
|
+
headingColumns: table.getAttribute( 'headingColumns' ) || 0
|
166
|
+
};
|
167
|
+
|
168
|
+
// We need to iterate over a table in order to get proper row & column values from a walker
|
169
|
+
for ( const tableSlot of tableWalker ) {
|
170
|
+
if ( tableSlot.cell === tableCell ) {
|
171
|
+
const trElement = conversionApi.mapper.toViewElement( tableRow );
|
172
|
+
const insertPosition = conversionApi.writer.createPositionAt( trElement, tableRow.getChildIndex( tableCell ) );
|
173
|
+
|
174
|
+
createViewTableCellElement( tableSlot, tableAttributes, insertPosition, conversionApi, { asWidget: true } );
|
175
|
+
|
176
|
+
// No need to iterate further.
|
177
|
+
return;
|
178
|
+
}
|
179
|
+
}
|
180
|
+
} );
|
181
|
+
}
|
182
|
+
|
183
|
+
/**
|
184
|
+
* Conversion helper that acts on heading column table attribute change.
|
185
|
+
*
|
186
|
+
* Depending on changed attributes this converter will rename `<td` to `<th>` elements or vice versa depending on the cell column index.
|
187
|
+
*
|
188
|
+
* @returns {Function} Conversion helper.
|
189
|
+
*/
|
190
|
+
export function downcastTableHeadingColumnsChange() {
|
191
|
+
return dispatcher => dispatcher.on( 'attribute:headingColumns:table', ( evt, data, conversionApi ) => {
|
192
|
+
const table = data.item;
|
193
|
+
|
194
|
+
if ( !conversionApi.consumable.consume( data.item, evt.name ) ) {
|
195
|
+
return;
|
196
|
+
}
|
197
|
+
|
198
|
+
const tableAttributes = {
|
199
|
+
headingRows: table.getAttribute( 'headingRows' ) || 0,
|
200
|
+
headingColumns: table.getAttribute( 'headingColumns' ) || 0
|
201
|
+
};
|
202
|
+
|
203
|
+
const oldColumns = data.attributeOldValue;
|
204
|
+
const newColumns = data.attributeNewValue;
|
205
|
+
|
206
|
+
const lastColumnToCheck = ( oldColumns > newColumns ? oldColumns : newColumns ) - 1;
|
207
|
+
|
208
|
+
for ( const tableSlot of new TableWalker( table, { endColumn: lastColumnToCheck } ) ) {
|
209
|
+
renameViewTableCellIfRequired( tableSlot, tableAttributes, conversionApi );
|
210
|
+
}
|
211
|
+
} );
|
212
|
+
}
|
213
|
+
|
214
|
+
/**
|
215
|
+
* Conversion helper that acts on a removed row.
|
216
|
+
*
|
217
|
+
* @returns {Function} Conversion helper.
|
218
|
+
*/
|
219
|
+
export function downcastRemoveRow() {
|
220
|
+
return dispatcher => dispatcher.on( 'remove:tableRow', ( evt, data, conversionApi ) => {
|
221
|
+
// Prevent default remove converter.
|
222
|
+
evt.stop();
|
223
|
+
const viewWriter = conversionApi.writer;
|
224
|
+
const mapper = conversionApi.mapper;
|
225
|
+
|
226
|
+
const viewStart = mapper.toViewPosition( data.position ).getLastMatchingPosition( value => !value.item.is( 'element', 'tr' ) );
|
227
|
+
const viewItem = viewStart.nodeAfter;
|
228
|
+
const tableSection = viewItem.parent;
|
229
|
+
const viewTable = tableSection.parent;
|
230
|
+
|
231
|
+
// Remove associated <tr> from the view.
|
232
|
+
const removeRange = viewWriter.createRangeOn( viewItem );
|
233
|
+
const removed = viewWriter.remove( removeRange );
|
234
|
+
|
235
|
+
for ( const child of viewWriter.createRangeIn( removed ).getItems() ) {
|
236
|
+
mapper.unbindViewElement( child );
|
237
|
+
}
|
238
|
+
|
239
|
+
// Cleanup: Ensure that thead & tbody sections are removed if left empty after removing rows. See #6437, #6391.
|
240
|
+
removeTableSectionIfEmpty( 'thead', viewTable, conversionApi );
|
241
|
+
removeTableSectionIfEmpty( 'tbody', viewTable, conversionApi );
|
242
|
+
}, { priority: 'higher' } );
|
243
|
+
}
|
244
|
+
|
245
|
+
/**
|
246
|
+
* Overrides paragraph inside table cell conversion.
|
247
|
+
*
|
248
|
+
* This converter:
|
249
|
+
* * should be used to override default paragraph conversion in the editing view.
|
250
|
+
* * It will only convert <paragraph> placed directly inside <tableCell>.
|
251
|
+
* * For a single paragraph without attributes it returns `<span>` to simulate data table.
|
252
|
+
* * For all other cases it returns `<p>` element.
|
253
|
+
*
|
254
|
+
* @param {module:engine/model/element~Element} modelElement
|
255
|
+
* @param {module:engine/conversion/downcastdispatcher~DowncastConversionApi} conversionApi
|
256
|
+
* @returns {module:engine/view/containerelement~ContainerElement|undefined}
|
257
|
+
*/
|
258
|
+
export function convertParagraphInTableCell( modelElement, conversionApi ) {
|
259
|
+
const { writer } = conversionApi;
|
260
|
+
|
261
|
+
if ( !modelElement.parent.is( 'element', 'tableCell' ) ) {
|
262
|
+
return;
|
263
|
+
}
|
264
|
+
|
265
|
+
if ( isSingleParagraphWithoutAttributes( modelElement ) ) {
|
266
|
+
// Use display:inline-block to force Chrome/Safari to limit text mutations to this element.
|
267
|
+
// See #6062.
|
268
|
+
return writer.createContainerElement( 'span', { style: 'display:inline-block' } );
|
269
|
+
} else {
|
270
|
+
return writer.createContainerElement( 'p' );
|
271
|
+
}
|
272
|
+
}
|
273
|
+
|
274
|
+
/**
|
275
|
+
* Checks if given model `<paragraph>` is an only child of a parent (`<tableCell>`) and if it has any attribute set.
|
276
|
+
*
|
277
|
+
* The paragraph should be converted in the editing view to:
|
278
|
+
*
|
279
|
+
* * If returned `true` - to a `<span style="display:inline-block">`
|
280
|
+
* * If returned `false` - to a `<p>`
|
281
|
+
*
|
282
|
+
* @param {module:engine/model/element~Element} modelElement
|
283
|
+
* @returns {Boolean}
|
284
|
+
*/
|
285
|
+
export function isSingleParagraphWithoutAttributes( modelElement ) {
|
286
|
+
const tableCell = modelElement.parent;
|
287
|
+
|
288
|
+
const isSingleParagraph = tableCell.childCount === 1;
|
289
|
+
|
290
|
+
return isSingleParagraph && !hasAnyAttribute( modelElement );
|
291
|
+
}
|
292
|
+
|
293
|
+
// Converts a given {@link module:engine/view/element~Element} to a table widget:
|
294
|
+
// * Adds a {@link module:engine/view/element~Element#_setCustomProperty custom property} allowing to recognize the table widget element.
|
295
|
+
// * Calls the {@link module:widget/utils~toWidget} function with the proper element's label creator.
|
296
|
+
//
|
297
|
+
// @param {module:engine/view/element~Element} viewElement
|
298
|
+
// @param {module:engine/view/downcastwriter~DowncastWriter} writer An instance of the view writer.
|
299
|
+
// @param {String} label The element's label. It will be concatenated with the table `alt` attribute if one is present.
|
300
|
+
// @returns {module:engine/view/element~Element}
|
301
|
+
function toTableWidget( viewElement, writer ) {
|
302
|
+
writer.setCustomProperty( 'table', true, viewElement );
|
303
|
+
return toWidget( viewElement, writer, { hasSelectionHandle: true } );
|
304
|
+
}
|
305
|
+
|
306
|
+
// Renames an existing table cell in the view to a given element name.
|
307
|
+
//
|
308
|
+
// **Note** This method will not do anything if a view table cell has not been converted yet.
|
309
|
+
//
|
310
|
+
// @param {module:engine/model/element~Element} tableCell
|
311
|
+
// @param {String} desiredCellElementName
|
312
|
+
// @param {module:engine/conversion/downcastdispatcher~DowncastConversionApi} conversionApi
|
313
|
+
function renameViewTableCell( tableCell, desiredCellElementName, conversionApi ) {
|
314
|
+
const viewWriter = conversionApi.writer;
|
315
|
+
const viewCell = conversionApi.mapper.toViewElement( tableCell );
|
316
|
+
|
317
|
+
const editable = viewWriter.createEditableElement( desiredCellElementName, viewCell.getAttributes() );
|
318
|
+
const renamedCell = toWidgetEditable( editable, viewWriter );
|
319
|
+
|
320
|
+
setHighlightHandling(
|
321
|
+
renamedCell,
|
322
|
+
viewWriter,
|
323
|
+
( element, descriptor, writer ) => writer.addClass( toArray( descriptor.classes ), element ),
|
324
|
+
( element, descriptor, writer ) => writer.removeClass( toArray( descriptor.classes ), element )
|
325
|
+
);
|
326
|
+
|
327
|
+
viewWriter.insert( viewWriter.createPositionAfter( viewCell ), renamedCell );
|
328
|
+
viewWriter.move( viewWriter.createRangeIn( viewCell ), viewWriter.createPositionAt( renamedCell, 0 ) );
|
329
|
+
viewWriter.remove( viewWriter.createRangeOn( viewCell ) );
|
330
|
+
|
331
|
+
conversionApi.mapper.unbindViewElement( viewCell );
|
332
|
+
conversionApi.mapper.bindElements( tableCell, renamedCell );
|
333
|
+
}
|
334
|
+
|
335
|
+
// Renames a table cell element in the view according to its location in the table.
|
336
|
+
//
|
337
|
+
// @param {module:table/tablewalker~TableSlot} tableSlot
|
338
|
+
// @param {{headingColumns, headingRows}} tableAttributes
|
339
|
+
// @param {module:engine/conversion/downcastdispatcher~DowncastConversionApi} conversionApi
|
340
|
+
function renameViewTableCellIfRequired( tableSlot, tableAttributes, conversionApi ) {
|
341
|
+
const { cell } = tableSlot;
|
342
|
+
|
343
|
+
// Check whether current columnIndex is overlapped by table cells from previous rows.
|
344
|
+
const desiredCellElementName = getCellElementName( tableSlot, tableAttributes );
|
345
|
+
|
346
|
+
const viewCell = conversionApi.mapper.toViewElement( cell );
|
347
|
+
|
348
|
+
// If in single change we're converting attribute changes and inserting cell the table cell might not be inserted into view
|
349
|
+
// because of child conversion is done after parent.
|
350
|
+
if ( viewCell && viewCell.name !== desiredCellElementName ) {
|
351
|
+
renameViewTableCell( cell, desiredCellElementName, conversionApi );
|
352
|
+
}
|
353
|
+
}
|
354
|
+
|
355
|
+
// Creates a table cell element in the view.
|
356
|
+
//
|
357
|
+
// @param {module:table/tablewalker~TableSlot} tableSlot
|
358
|
+
// @param {module:engine/view/position~Position} insertPosition
|
359
|
+
// @param {module:engine/conversion/downcastdispatcher~DowncastConversionApi} conversionApi
|
360
|
+
function createViewTableCellElement( tableSlot, tableAttributes, insertPosition, conversionApi, options ) {
|
361
|
+
const asWidget = options && options.asWidget;
|
362
|
+
const cellElementName = getCellElementName( tableSlot, tableAttributes );
|
363
|
+
|
364
|
+
const cellElement = asWidget ?
|
365
|
+
toWidgetEditable( conversionApi.writer.createEditableElement( cellElementName ), conversionApi.writer ) :
|
366
|
+
conversionApi.writer.createContainerElement( cellElementName, {style: 'border: 1px solid'} );
|
367
|
+
|
368
|
+
if ( asWidget ) {
|
369
|
+
setHighlightHandling(
|
370
|
+
cellElement,
|
371
|
+
conversionApi.writer,
|
372
|
+
( element, descriptor, writer ) => writer.addClass( toArray( descriptor.classes ), element ),
|
373
|
+
( element, descriptor, writer ) => writer.removeClass( toArray( descriptor.classes ), element )
|
374
|
+
);
|
375
|
+
}
|
376
|
+
|
377
|
+
const tableCell = tableSlot.cell;
|
378
|
+
|
379
|
+
const firstChild = tableCell.getChild( 0 );
|
380
|
+
const isSingleParagraph = tableCell.childCount === 1 && firstChild.name === 'paragraph';
|
381
|
+
|
382
|
+
conversionApi.writer.insert( insertPosition, cellElement );
|
383
|
+
|
384
|
+
conversionApi.mapper.bindElements( tableCell, cellElement );
|
385
|
+
|
386
|
+
// Additional requirement for data pipeline to have backward compatible data tables.
|
387
|
+
if ( !asWidget && isSingleParagraph && !hasAnyAttribute( firstChild ) ) {
|
388
|
+
const innerParagraph = tableCell.getChild( 0 );
|
389
|
+
|
390
|
+
conversionApi.consumable.consume( innerParagraph, 'insert' );
|
391
|
+
|
392
|
+
conversionApi.mapper.bindElements( innerParagraph, cellElement );
|
393
|
+
}
|
394
|
+
}
|
395
|
+
|
396
|
+
// Creates a `<tr>` view element.
|
397
|
+
//
|
398
|
+
// @param {module:engine/view/element~Element} tableElement
|
399
|
+
// @param {module:engine/model/element~Element} tableRow
|
400
|
+
// @param {Number} rowIndex
|
401
|
+
// @param {{headingColumns, headingRows}} tableAttributes
|
402
|
+
// @param {module:engine/conversion/downcastdispatcher~DowncastConversionApi} conversionApi
|
403
|
+
// @returns {module:engine/view/element~Element}
|
404
|
+
function createTr( tableElement, tableRow, rowIndex, tableAttributes, conversionApi ) {
|
405
|
+
// Will always consume since we're converting <tableRow> element from a parent <table>.
|
406
|
+
conversionApi.consumable.consume( tableRow, 'insert' );
|
407
|
+
|
408
|
+
const trElement = tableRow.isEmpty ?
|
409
|
+
conversionApi.writer.createEmptyElement( 'tr' ) :
|
410
|
+
conversionApi.writer.createContainerElement( 'tr' );
|
411
|
+
|
412
|
+
conversionApi.mapper.bindElements( tableRow, trElement );
|
413
|
+
|
414
|
+
const headingRows = tableAttributes.headingRows;
|
415
|
+
const tableSection = getOrCreateTableSection( getSectionName( rowIndex, tableAttributes ), tableElement, conversionApi );
|
416
|
+
|
417
|
+
const offset = headingRows > 0 && rowIndex >= headingRows ? rowIndex - headingRows : rowIndex;
|
418
|
+
const position = conversionApi.writer.createPositionAt( tableSection, offset );
|
419
|
+
|
420
|
+
conversionApi.writer.insert( position, trElement );
|
421
|
+
|
422
|
+
return trElement;
|
423
|
+
}
|
424
|
+
|
425
|
+
// Returns `th` for heading cells and `td` for other cells for the current table walker value.
|
426
|
+
//
|
427
|
+
// @param {module:table/tablewalker~TableSlot} tableSlot
|
428
|
+
// @param {{headingColumns, headingRows}} tableAttributes
|
429
|
+
// @returns {String}
|
430
|
+
function getCellElementName( tableSlot, tableAttributes ) {
|
431
|
+
const { row, column } = tableSlot;
|
432
|
+
const { headingColumns, headingRows } = tableAttributes;
|
433
|
+
|
434
|
+
// Column heading are all tableCells in the first `columnHeading` rows.
|
435
|
+
const isColumnHeading = headingRows && headingRows > row;
|
436
|
+
|
437
|
+
// So a whole row gets <th> element.
|
438
|
+
if ( isColumnHeading ) {
|
439
|
+
return 'th';
|
440
|
+
}
|
441
|
+
|
442
|
+
// Row heading are tableCells which columnIndex is lower then headingColumns.
|
443
|
+
const isRowHeading = headingColumns && headingColumns > column;
|
444
|
+
|
445
|
+
return isRowHeading ? 'th' : 'td';
|
446
|
+
}
|
447
|
+
|
448
|
+
// Returns the table section name for the current table walker value.
|
449
|
+
//
|
450
|
+
// @param {Number} row
|
451
|
+
// @param {{headingColumns, headingRows}} tableAttributes
|
452
|
+
// @returns {String}
|
453
|
+
function getSectionName( row, tableAttributes ) {
|
454
|
+
return row < tableAttributes.headingRows ? 'thead' : 'tbody';
|
455
|
+
}
|
456
|
+
|
457
|
+
// Creates or returns an existing `<tbody>` or `<thead>` element with caching.
|
458
|
+
//
|
459
|
+
// @param {String} sectionName
|
460
|
+
// @param {module:engine/view/element~Element} viewTable
|
461
|
+
// @param {module:engine/conversion/downcastdispatcher~DowncastConversionApi} conversionApi
|
462
|
+
// @param {Object} cachedTableSection An object that stores cached elements.
|
463
|
+
// @returns {module:engine/view/containerelement~ContainerElement}
|
464
|
+
function getOrCreateTableSection( sectionName, viewTable, conversionApi ) {
|
465
|
+
const viewTableSection = getExistingTableSectionElement( sectionName, viewTable );
|
466
|
+
|
467
|
+
return viewTableSection ? viewTableSection : createTableSection( sectionName, viewTable, conversionApi );
|
468
|
+
}
|
469
|
+
|
470
|
+
// Finds an existing `<tbody>` or `<thead>` element or returns undefined.
|
471
|
+
//
|
472
|
+
// @param {String} sectionName
|
473
|
+
// @param {module:engine/view/element~Element} tableElement
|
474
|
+
// @param {module:engine/conversion/downcastdispatcher~DowncastConversionApi} conversionApi
|
475
|
+
function getExistingTableSectionElement( sectionName, tableElement ) {
|
476
|
+
for ( const tableSection of tableElement.getChildren() ) {
|
477
|
+
if ( tableSection.name == sectionName ) {
|
478
|
+
return tableSection;
|
479
|
+
}
|
480
|
+
}
|
481
|
+
}
|
482
|
+
|
483
|
+
// Creates a table section at the end of the table.
|
484
|
+
//
|
485
|
+
// @param {String} sectionName
|
486
|
+
// @param {module:engine/view/element~Element} tableElement
|
487
|
+
// @param {module:engine/conversion/downcastdispatcher~DowncastConversionApi} conversionApi
|
488
|
+
// @returns {module:engine/view/containerelement~ContainerElement}
|
489
|
+
function createTableSection( sectionName, tableElement, conversionApi ) {
|
490
|
+
const tableChildElement = conversionApi.writer.createContainerElement( sectionName );
|
491
|
+
|
492
|
+
const insertPosition = conversionApi.writer.createPositionAt( tableElement, sectionName == 'tbody' ? 'end' : 0 );
|
493
|
+
|
494
|
+
conversionApi.writer.insert( insertPosition, tableChildElement );
|
495
|
+
|
496
|
+
return tableChildElement;
|
497
|
+
}
|
498
|
+
|
499
|
+
// Removes an existing `<tbody>` or `<thead>` element if it is empty.
|
500
|
+
//
|
501
|
+
// @param {String} sectionName
|
502
|
+
// @param {module:engine/view/element~Element} tableElement
|
503
|
+
// @param {module:engine/conversion/downcastdispatcher~DowncastConversionApi} conversionApi
|
504
|
+
function removeTableSectionIfEmpty( sectionName, tableElement, conversionApi ) {
|
505
|
+
const tableSection = getExistingTableSectionElement( sectionName, tableElement );
|
506
|
+
|
507
|
+
if ( tableSection && tableSection.childCount === 0 ) {
|
508
|
+
conversionApi.writer.remove( conversionApi.writer.createRangeOn( tableSection ) );
|
509
|
+
}
|
510
|
+
}
|
511
|
+
|
512
|
+
// Finds a '<table>' element inside the `<figure>` widget.
|
513
|
+
//
|
514
|
+
// @param {module:engine/view/element~Element} viewFigure
|
515
|
+
function getViewTable( viewFigure ) {
|
516
|
+
for ( const child of viewFigure.getChildren() ) {
|
517
|
+
if ( child.name === 'table' ) {
|
518
|
+
return child;
|
519
|
+
}
|
520
|
+
}
|
521
|
+
}
|
522
|
+
|
523
|
+
// Checks if an element has any attributes set.
|
524
|
+
//
|
525
|
+
// @param {module:engine/model/element~Element element
|
526
|
+
// @returns {Boolean}
|
527
|
+
function hasAnyAttribute( element ) {
|
528
|
+
return !![ ...element.getAttributeKeys() ].length;
|
529
|
+
}
|
@@ -0,0 +1,136 @@
|
|
1
|
+
/**
|
2
|
+
* @license Copyright (c) 2003-2021, CKSource - Frederico Knabben. All rights reserved.
|
3
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
4
|
+
*/
|
5
|
+
|
6
|
+
/**
|
7
|
+
* @module table/converters/table-cell-paragraph-post-fixer
|
8
|
+
*/
|
9
|
+
|
10
|
+
/**
|
11
|
+
* Injects a table cell post-fixer into the model which inserts a `paragraph` element into empty table cells.
|
12
|
+
*
|
13
|
+
* A table cell must contain at least one block element as a child. An empty table cell will have an empty `paragraph` as a child.
|
14
|
+
*
|
15
|
+
* <table>
|
16
|
+
* <tableRow>
|
17
|
+
* <tableCell></tableCell>
|
18
|
+
* </tableRow>
|
19
|
+
* </table>
|
20
|
+
*
|
21
|
+
* Will be fixed to:
|
22
|
+
*
|
23
|
+
* <table>
|
24
|
+
* <tableRow>
|
25
|
+
* <tableCell><paragraph></paragraph></tableCell>
|
26
|
+
* </tableRow>
|
27
|
+
* </table>
|
28
|
+
*
|
29
|
+
* @param {module:engine/model/model~Model} model
|
30
|
+
*/
|
31
|
+
export default function injectTableCellParagraphPostFixer( model ) {
|
32
|
+
model.document.registerPostFixer( writer => tableCellContentsPostFixer( writer, model ) );
|
33
|
+
}
|
34
|
+
|
35
|
+
// The table cell contents post-fixer.
|
36
|
+
//
|
37
|
+
// @param {module:engine/model/writer~Writer} writer
|
38
|
+
// @param {module:engine/model/model~Model} model
|
39
|
+
function tableCellContentsPostFixer( writer, model ) {
|
40
|
+
const changes = model.document.differ.getChanges();
|
41
|
+
|
42
|
+
let wasFixed = false;
|
43
|
+
|
44
|
+
for ( const entry of changes ) {
|
45
|
+
if ( entry.type == 'insert' && entry.name == 'table' ) {
|
46
|
+
wasFixed = fixTable( entry.position.nodeAfter, writer ) || wasFixed;
|
47
|
+
}
|
48
|
+
|
49
|
+
if ( entry.type == 'insert' && entry.name == 'tableRow' ) {
|
50
|
+
wasFixed = fixTableRow( entry.position.nodeAfter, writer ) || wasFixed;
|
51
|
+
}
|
52
|
+
|
53
|
+
if ( entry.type == 'insert' && entry.name == 'tableCell' ) {
|
54
|
+
wasFixed = fixTableCellContent( entry.position.nodeAfter, writer ) || wasFixed;
|
55
|
+
}
|
56
|
+
|
57
|
+
if ( checkTableCellChange( entry ) ) {
|
58
|
+
wasFixed = fixTableCellContent( entry.position.parent, writer ) || wasFixed;
|
59
|
+
}
|
60
|
+
}
|
61
|
+
|
62
|
+
return wasFixed;
|
63
|
+
}
|
64
|
+
|
65
|
+
// Fixes all table cells in a table.
|
66
|
+
//
|
67
|
+
// @param {module:engine/model/element~Element} table
|
68
|
+
// @param {module:engine/model/writer~Writer} writer
|
69
|
+
function fixTable( table, writer ) {
|
70
|
+
let wasFixed = false;
|
71
|
+
|
72
|
+
for ( const row of table.getChildren() ) {
|
73
|
+
wasFixed = fixTableRow( row, writer ) || wasFixed;
|
74
|
+
}
|
75
|
+
|
76
|
+
return wasFixed;
|
77
|
+
}
|
78
|
+
|
79
|
+
// Fixes all table cells in a table row.
|
80
|
+
//
|
81
|
+
// @param {module:engine/model/element~Element} tableRow
|
82
|
+
// @param {module:engine/model/writer~Writer} writer
|
83
|
+
function fixTableRow( tableRow, writer ) {
|
84
|
+
let wasFixed = false;
|
85
|
+
|
86
|
+
for ( const tableCell of tableRow.getChildren() ) {
|
87
|
+
wasFixed = fixTableCellContent( tableCell, writer ) || wasFixed;
|
88
|
+
}
|
89
|
+
|
90
|
+
return wasFixed;
|
91
|
+
}
|
92
|
+
|
93
|
+
// Fixes all table cell content by:
|
94
|
+
// - Adding a paragraph to a table cell without any child.
|
95
|
+
// - Wrapping direct $text in a `<paragraph>`.
|
96
|
+
//
|
97
|
+
// @param {module:engine/model/element~Element} table
|
98
|
+
// @param {module:engine/model/writer~Writer} writer
|
99
|
+
// @returns {Boolean}
|
100
|
+
function fixTableCellContent( tableCell, writer ) {
|
101
|
+
// Insert paragraph to an empty table cell.
|
102
|
+
if ( tableCell.childCount == 0 ) {
|
103
|
+
// @if CK_DEBUG_TABLE // console.log( 'Post-fixing table: insert paragraph in empty cell.' );
|
104
|
+
|
105
|
+
writer.insertElement( 'paragraph', tableCell );
|
106
|
+
|
107
|
+
return true;
|
108
|
+
}
|
109
|
+
|
110
|
+
// Check table cell children for directly placed text nodes.
|
111
|
+
// Temporary solution. See https://github.com/ckeditor/ckeditor5/issues/1464.
|
112
|
+
const textNodes = Array.from( tableCell.getChildren() ).filter( child => child.is( '$text' ) );
|
113
|
+
|
114
|
+
// @if CK_DEBUG_TABLE // textNodes.length && console.log( 'Post-fixing table: wrap cell content with paragraph.' );
|
115
|
+
|
116
|
+
for ( const child of textNodes ) {
|
117
|
+
writer.wrap( writer.createRangeOn( child ), 'paragraph' );
|
118
|
+
}
|
119
|
+
|
120
|
+
// Return true when there were text nodes to fix.
|
121
|
+
return !!textNodes.length;
|
122
|
+
}
|
123
|
+
|
124
|
+
// Checks if a differ change should fix the table cell. This happens on:
|
125
|
+
// - Removing content from the table cell (i.e. `tableCell` can be left empty).
|
126
|
+
// - Adding a text node directly into a table cell.
|
127
|
+
//
|
128
|
+
// @param {Object} differ change entry
|
129
|
+
// @returns {Boolean}
|
130
|
+
function checkTableCellChange( entry ) {
|
131
|
+
if ( !entry.position || !entry.position.parent.is( 'element', 'tableCell' ) ) {
|
132
|
+
return false;
|
133
|
+
}
|
134
|
+
|
135
|
+
return entry.type == 'insert' && entry.name == '$text' || entry.type == 'remove';
|
136
|
+
}
|