qms-angular 1.0.71 → 1.0.75
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 +960 -583
- package/bundles/qms-angular.umd.js.map +1 -1
- package/esm2015/lib/components/button/button.js +1 -1
- package/esm2015/lib/components/comment/comment.js +2 -2
- package/esm2015/lib/components/qms-navigation-drawer/qms-navigation-drawer.component.js +7 -6
- package/esm2015/lib/components/qms-navigation-drawer/qms-navigation-drawer.module.js +4 -4
- package/esm2015/lib/components/qms-paginator/qms-paginator.component.js +3 -3
- package/esm2015/lib/components/qms-stepper/qms-stepper.component.js +1 -1
- 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/select-process-document/select-process-document.component.js +64 -143
- 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 +50 -0
- package/esm2015/lib/directives/table/table.directive.js +18 -61
- package/esm2015/lib/model/en.js +19 -2
- package/esm2015/lib/model/no.js +19 -2
- package/esm2015/lib/qms-angular.module.js +5 -24
- package/esm2015/lib/qms-ckeditor-components/common/classes/qmsUploadAdapter.js +89 -0
- package/esm2015/lib/qms-ckeditor-components/common/constants/ckeditorEvent.constant.js +3 -1
- 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-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/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 +22 -3
- 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/qms-ckeditor-link.component.js +4 -1
- package/esm2015/lib/qms-ckeditor-components/components/qms-ckeditor-tooltip/qms-ckeditor-tooltip.component.js +3 -4
- package/esm2015/lib/qms-ckeditor-components/qms-ckeditor.component.js +178 -28
- package/esm2015/lib/qms-ckeditor-components/qms-ckeditor.module.js +7 -3
- 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 +6 -7
- package/esm2015/qms-angular.js +6 -4
- package/fesm2015/qms-angular.js +862 -524
- 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 -1
- 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/components/select-process-document/select-process-document.component.d.ts +3 -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 +2 -11
- package/lib/model/en.d.ts +17 -0
- package/lib/model/no.d.ts +17 -0
- package/lib/qms-ckeditor-components/common/classes/qmsUploadAdapter.d.ts +18 -0
- package/lib/qms-ckeditor-components/common/constants/ckeditorEvent.constant.d.ts +2 -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-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 +4 -1
- package/lib/qms-ckeditor-components/components/qms-ckeditor-imagemap/qms-ckeditor-imagemap.component.d.ts +2 -1
- package/lib/qms-ckeditor-components/qms-ckeditor.component.d.ts +17 -5
- 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 +3 -6
- package/qms-angular.d.ts +5 -3
- package/qms-angular.metadata.json +1 -1
- package/src/assets/images/ckeditor5.svg +1 -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/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 +5 -68
- 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 +4 -0
- package/src/assets/qms-ckeditor-plugin/src/plugins/common/qmsCKEditorService.js +21 -0
- package/src/assets/qms-ckeditor-plugin/src/plugins/fullscreen/qmsCKEditorFullscreenPlugin.js +22 -15
- package/src/assets/qms-ckeditor-plugin/src/plugins/imagemap/imagemapcommand.js +1 -0
- package/src/assets/qms-ckeditor-plugin/src/plugins/imagemap/utils.js +1 -1
- 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/qms-navigation-drawer/qms-navigation-drawer.component.scss +37 -20
- package/src/lib/components/qms-paginator/qms-paginator.component.scss +15 -0
- package/src/lib/components/qms-stepper/qms-stepper.component.scss +2 -1
- package/src/lib/components/select-process-document/select-process-document.component.scss +2 -2
- 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-imagemap/qms-ckeditor-imagemap.component.scss +25 -23
- package/src/lib/qms-ckeditor-components/qms-ckeditor.component.scss +24 -0
- package/src/themes/core/_range-slider.scss +61 -42
- package/src/themes/core/_side-sheet.scss +2 -2
- package/src/themes/core/_table.scss +176 -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/tooltip/inserttooltipcommand.js +0 -88
@@ -1,203 +1,491 @@
|
|
1
|
-
|
2
|
-
import Plugin from '@ckeditor/ckeditor5-core
|
3
|
-
import informationIcon from '../../themes/icons/information.svg';
|
4
|
-
import * as QMSCKEditorConstant from '../common/qmsCKEditorConstant';
|
5
|
-
import * as QMSCKEditorService from '../common/qmsCKEditorService';
|
6
|
-
import ActionsView from './ui/actionsview';
|
1
|
+
|
2
|
+
import { Plugin } from '@ckeditor/ckeditor5-core';
|
7
3
|
import { ClickObserver } from '@ckeditor/ckeditor5-engine';
|
8
4
|
import { ButtonView, ContextualBalloon, clickOutsideHandler } from '@ckeditor/ckeditor5-ui';
|
9
|
-
import
|
5
|
+
import tooltipIcon from '../../themes/icons/tooltip.svg';
|
6
|
+
import ActionsView from './ui/actionsview';
|
7
|
+
import { isTooltipElement, isImageAllowed, TOOLTIP_COMMANDS, HTML_ATTRIBUTE, HTML_CLASS, TOOLTIP_ATTRIBUTE, TOOLTIP_CUSTOM_PROPERTY} from './utils';
|
8
|
+
import * as QMSCKEditorConstant from '../common/qmsCKEditorConstant';
|
9
|
+
import * as QMSCKEditorService from '../common/qmsCKEditorService';
|
10
10
|
|
11
|
+
const VISUAL_SELECTION_MARKER_NAME = 'tooltip-ui';
|
12
|
+
|
11
13
|
export default class TooltipUI extends Plugin {
|
14
|
+
/**
|
15
|
+
* @inheritDoc
|
16
|
+
*/
|
12
17
|
static get requires() {
|
13
|
-
return [ContextualBalloon];
|
18
|
+
return [ ContextualBalloon ];
|
14
19
|
}
|
15
|
-
|
20
|
+
|
21
|
+
/**
|
22
|
+
* @inheritDoc
|
23
|
+
*/
|
16
24
|
static get pluginName() {
|
17
25
|
return 'TooltipUI';
|
18
26
|
}
|
19
27
|
|
20
|
-
|
21
|
-
|
22
|
-
|
28
|
+
/**
|
29
|
+
* @inheritDoc
|
30
|
+
*/
|
31
|
+
init() {
|
32
|
+
const editor = this.editor;
|
23
33
|
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
view.addObserver(ClickObserver);
|
34
|
-
this._createActionsView();
|
35
|
-
|
36
|
-
editor.ui.componentFactory.add('tooltip', locale => {
|
37
|
-
const buttonView = new ButtonView(locale);
|
38
|
-
|
39
|
-
buttonView.set({
|
40
|
-
label: t('Tooltip'),
|
41
|
-
icon: informationIcon,
|
42
|
-
withText: true,
|
43
|
-
tooltip: true
|
44
|
-
});
|
34
|
+
editor.editing.view.addObserver(ClickObserver);
|
35
|
+
|
36
|
+
/**
|
37
|
+
* The actions view displayed inside of the balloon.
|
38
|
+
*
|
39
|
+
* @member {module:link/ui/TooltipActionView~TooltipActionView}
|
40
|
+
*/
|
41
|
+
this.actionsView = this._createActionsView();
|
45
42
|
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
43
|
+
/**
|
44
|
+
* The contextual balloon plugin instance.
|
45
|
+
*
|
46
|
+
* @private
|
47
|
+
* @member {module:ui/panel/balloon/contextualballoon~ContextualBalloon}
|
48
|
+
*/
|
49
|
+
this._balloon = editor.plugins.get(ContextualBalloon);
|
50
50
|
|
51
|
-
|
52
|
-
|
53
|
-
});
|
51
|
+
// Create toolbar buttons.
|
52
|
+
this._createToolbarLinkButton();
|
54
53
|
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
54
|
+
// Attach lifecycle actions to the the balloon.
|
55
|
+
this._enableUserBalloonInteractions();
|
56
|
+
|
57
|
+
// Renders a fake visual selection marker on an expanded selection.
|
58
|
+
editor.conversion.for('editingDowncast').markerToHighlight({
|
59
|
+
model: VISUAL_SELECTION_MARKER_NAME,
|
60
|
+
view: {
|
61
|
+
classes: [ 'ck-fake-link-selection' ]
|
62
|
+
}
|
63
|
+
});
|
64
|
+
|
65
|
+
// Renders a fake visual selection marker on a collapsed selection.
|
66
|
+
editor.conversion.for('editingDowncast').markerToElement({
|
67
|
+
model: VISUAL_SELECTION_MARKER_NAME,
|
68
|
+
view: {
|
69
|
+
name: 'span',
|
70
|
+
classes: [ 'ck-fake-link-selection', 'ck-fake-link-selection_collapsed' ]
|
71
|
+
}
|
72
|
+
});
|
73
|
+
}
|
74
|
+
|
75
|
+
/**
|
76
|
+
* @inheritDoc
|
77
|
+
*/
|
59
78
|
destroy() {
|
60
79
|
super.destroy();
|
61
|
-
this._actionView.destroy();
|
62
80
|
}
|
63
|
-
|
81
|
+
|
82
|
+
/**
|
83
|
+
* Creates the {@link module:link/ui/TooltipActionView~TooltipActionView} instance.
|
84
|
+
*
|
85
|
+
* @private
|
86
|
+
* @returns {module:link/ui/TooltipActionView~TooltipActionView} The link actions view instance.
|
87
|
+
*/
|
64
88
|
_createActionsView() {
|
65
89
|
const editor = this.editor;
|
66
|
-
const
|
67
|
-
const
|
68
|
-
|
69
|
-
this._actionView = new ActionsView(editor.locale);
|
90
|
+
const actionsView = new ActionsView(editor.locale);
|
91
|
+
const tooltipDialogCommand = editor.commands.get(TOOLTIP_COMMANDS.TOOLTIP_DIALOG);
|
92
|
+
const removeTooltipCommand = editor.commands.get(TOOLTIP_COMMANDS.REMOVE_TOOLTIP);
|
70
93
|
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
this.
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
94
|
+
actionsView.editButtonView.bind('isEnabled').to(tooltipDialogCommand);
|
95
|
+
actionsView.removeButtonView.bind('isEnabled').to(removeTooltipCommand);
|
96
|
+
|
97
|
+
// Execute unlink command after clicking on the "Edit" button.
|
98
|
+
this.listenTo(actionsView, 'edit', () => {
|
99
|
+
const tooltip = { text: '', content: '' };
|
100
|
+
const selectedElement = this._getSelectedTooltipElement();
|
101
|
+
if(selectedElement){
|
102
|
+
tooltip.content = selectedElement.getAttribute(HTML_ATTRIBUTE) || '';
|
103
|
+
if(selectedElement.childCount > 0){
|
104
|
+
tooltip.text = selectedElement.getChild(0).data;
|
105
|
+
}
|
106
|
+
}
|
107
|
+
QMSCKEditorService.tooltipNotify(tooltip);
|
108
|
+
window[QMSCKEditorConstant.QMSCK_TOOLTIP_IS_PROCESSING] = false;
|
109
|
+
window.addEventListener(QMSCKEditorConstant.QMSCK_TOOLTIP_PLUGIN_RESP, (evt) => {
|
110
|
+
if (window[QMSCKEditorConstant.QMSCK_TOOLTIP_IS_PROCESSING]) {
|
111
|
+
return;
|
112
|
+
}
|
113
|
+
window[QMSCKEditorConstant.QMSCK_TOOLTIP_IS_PROCESSING] = true;
|
114
|
+
const options = evt.detail;
|
115
|
+
editor.commands.get(TOOLTIP_COMMANDS.TOOLTIP).execute(options);
|
116
|
+
}, { once: true });
|
117
|
+
this._hideUI();
|
90
118
|
});
|
91
119
|
|
92
|
-
|
93
|
-
|
94
|
-
|
120
|
+
// Execute unlink command after clicking on the "Unlink" button.
|
121
|
+
this.listenTo(actionsView, 'remove', () => {
|
122
|
+
editor.execute(TOOLTIP_COMMANDS.REMOVE_TOOLTIP);
|
123
|
+
this._hideUI();
|
95
124
|
});
|
96
|
-
|
97
|
-
|
98
|
-
|
125
|
+
|
126
|
+
// Close the panel on esc key press when the **actions have focus**.
|
127
|
+
actionsView.keystrokes.set('Esc', (data, cancel) => {
|
128
|
+
this._hideUI();
|
99
129
|
cancel();
|
100
130
|
});
|
131
|
+
|
132
|
+
return actionsView;
|
133
|
+
}
|
134
|
+
|
135
|
+
/**
|
136
|
+
* Creates a toolbar Link button. Clicking this button will show
|
137
|
+
* a {@link #_balloon} attached to the selection.
|
138
|
+
*
|
139
|
+
* @private
|
140
|
+
*/
|
141
|
+
_createToolbarLinkButton() {
|
142
|
+
const editor = this.editor;
|
143
|
+
const command = editor.commands.get(TOOLTIP_COMMANDS.TOOLTIP_DIALOG);
|
144
|
+
const t = editor.t;
|
145
|
+
|
146
|
+
editor.ui.componentFactory.add('tooltip', locale => {
|
147
|
+
const button = new ButtonView(locale);
|
148
|
+
|
149
|
+
button.isEnabled = true;
|
150
|
+
button.label = t('Tooltip');
|
151
|
+
button.icon = tooltipIcon;
|
152
|
+
button.tooltip = true;
|
153
|
+
button.isToggleable = true;
|
154
|
+
|
155
|
+
// Bind button to the command.
|
156
|
+
button.bind('isEnabled').to(command, 'isEnabled');
|
157
|
+
button.bind('isOn').to(command, 'value', value => !!value);
|
158
|
+
|
159
|
+
// Show the panel on button click.
|
160
|
+
button.on('execute', () => {
|
161
|
+
editor.execute(TOOLTIP_COMMANDS.TOOLTIP_DIALOG);
|
162
|
+
});
|
163
|
+
|
164
|
+
return button;
|
165
|
+
});
|
166
|
+
}
|
167
|
+
|
168
|
+
_enableUserBalloonInteractions() {
|
169
|
+
const viewDocument = this.editor.editing.view.document;
|
170
|
+
|
171
|
+
// Handle click on view document and show panel when selection is placed inside the link element.
|
172
|
+
// Keep panel open until selection will be inside the same link element.
|
173
|
+
this.listenTo(viewDocument, 'click', () => {
|
174
|
+
const parentLink = this._getSelectedTooltipElement();
|
101
175
|
|
102
|
-
|
103
|
-
const selectedElement = this._getSelectedTooltipElement();
|
104
|
-
if (!!selectedElement) {
|
176
|
+
if (parentLink) {
|
105
177
|
// Then show panel but keep focus inside editor editable.
|
106
|
-
this.
|
178
|
+
this._showUI();
|
107
179
|
}
|
108
180
|
});
|
109
|
-
|
181
|
+
|
182
|
+
// Focus the form if the balloon is visible and the Tab key has been pressed.
|
183
|
+
this.editor.keystrokes.set('Tab', (data, cancel) => {
|
184
|
+
if (this._areActionsVisible && !this.actionsView.focusTracker.isFocused) {
|
185
|
+
this.actionsView.focus();
|
186
|
+
cancel();
|
187
|
+
}
|
188
|
+
}, {
|
189
|
+
// Use the high priority because the link UI navigation is more important
|
190
|
+
// than other feature's actions, e.g. list indentation.
|
191
|
+
// https://github.com/ckeditor/ckeditor5-link/issues/146
|
192
|
+
priority: 'high'
|
193
|
+
});
|
194
|
+
|
195
|
+
// Close the panel on the Esc key press when the editable has focus and the balloon is visible.
|
196
|
+
this.editor.keystrokes.set('Esc', (data, cancel) => {
|
197
|
+
if (this._isUIVisible) {
|
198
|
+
this._hideUI();
|
199
|
+
cancel();
|
200
|
+
}
|
201
|
+
});
|
202
|
+
|
110
203
|
// Close on click outside of balloon panel element.
|
111
204
|
clickOutsideHandler({
|
112
|
-
emitter: this.
|
113
|
-
activator: () => this.
|
205
|
+
emitter: this.actionsView,
|
206
|
+
activator: () => this._isUIInPanel,
|
114
207
|
contextElements: [ this._balloon.view.element ],
|
115
|
-
callback: () => this.
|
208
|
+
callback: () => this._hideUI()
|
116
209
|
});
|
117
210
|
}
|
118
211
|
|
119
|
-
|
120
|
-
|
212
|
+
/**
|
213
|
+
* Adds the {@link #actionsView} to the {@link #_balloon}.
|
214
|
+
*
|
215
|
+
* @protected
|
216
|
+
*/
|
217
|
+
_addActionsView() {
|
218
|
+
if (this._areActionsInPanel) {
|
121
219
|
return;
|
122
220
|
}
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
this._balloon.add({
|
130
|
-
view: this._actionView,
|
131
|
-
position: this._getBalloonPositionData()
|
132
|
-
});
|
133
|
-
}
|
221
|
+
|
222
|
+
this._balloon.add({
|
223
|
+
view: this.actionsView,
|
224
|
+
position: this._getBalloonPositionData()
|
225
|
+
});
|
226
|
+
}
|
134
227
|
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
228
|
+
|
229
|
+
_showUI(forceVisible = false) {
|
230
|
+
// When there's no link under the selection, go straight to the editing UI.
|
231
|
+
if (!this._getSelectedTooltipElement()) {
|
232
|
+
// Show visual selection on a text without a link when the contextual balloon is displayed.
|
233
|
+
// See https://github.com/ckeditor/ckeditor5/issues/4721.
|
234
|
+
this._showFakeVisualSelection();
|
235
|
+
|
236
|
+
this._addActionsView();
|
142
237
|
|
143
|
-
|
144
|
-
|
238
|
+
// Be sure panel with link is visible.
|
239
|
+
if (forceVisible) {
|
240
|
+
this._balloon.showStack('main');
|
145
241
|
}
|
146
|
-
|
147
|
-
|
148
|
-
|
242
|
+
|
243
|
+
}
|
244
|
+
// If there's a link under the selection...
|
245
|
+
else {
|
246
|
+
this._addActionsView();
|
247
|
+
|
248
|
+
// Be sure panel with link is visible.
|
249
|
+
if (forceVisible) {
|
250
|
+
this._balloon.showStack('main');
|
149
251
|
}
|
150
|
-
}
|
151
|
-
}
|
252
|
+
}
|
152
253
|
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
return {
|
157
|
-
target: editingView.domConverter.viewToDom(selectedElement)
|
158
|
-
};
|
159
|
-
}
|
254
|
+
// Begin responding to ui#update once the UI is added.
|
255
|
+
this._startUpdatingUI();
|
256
|
+
}
|
160
257
|
|
161
|
-
|
162
|
-
if (!this.
|
258
|
+
_hideUI() {
|
259
|
+
if (!this._isUIInPanel) {
|
163
260
|
return;
|
164
261
|
}
|
262
|
+
|
263
|
+
const editor = this.editor;
|
264
|
+
|
265
|
+
this.stopListening(editor.ui, 'update');
|
266
|
+
this.stopListening(this._balloon, 'change:visibleView');
|
267
|
+
|
268
|
+
// Make sure the focus always gets back to the editable _before_ removing the focused form view.
|
269
|
+
// Doing otherwise causes issues in some browsers. See https://github.com/ckeditor/ckeditor5-link/issues/193.
|
270
|
+
editor.editing.view.focus();
|
165
271
|
|
166
|
-
|
167
|
-
|
272
|
+
// Then remove the actions view because it's beneath the form.
|
273
|
+
this._balloon.remove(this.actionsView);
|
274
|
+
|
275
|
+
this._hideFakeVisualSelection();
|
276
|
+
}
|
277
|
+
|
278
|
+
/**
|
279
|
+
* Makes the UI react to the {@link module:core/editor/editorui~EditorUI#event:update} event to
|
280
|
+
* reposition itself when the editor UI should be refreshed.
|
281
|
+
*
|
282
|
+
* See: {@link #_hideUI} to learn when the UI stops reacting to the `update` event.
|
283
|
+
*
|
284
|
+
* @protected
|
285
|
+
*/
|
286
|
+
_startUpdatingUI() {
|
287
|
+
const editor = this.editor;
|
288
|
+
const viewDocument = editor.editing.view.document;
|
289
|
+
|
290
|
+
let prevSelectedLink = this._getSelectedTooltipElement();
|
291
|
+
let prevSelectionParent = getSelectionParent();
|
292
|
+
|
293
|
+
const update = () => {
|
294
|
+
const selectedLink = this._getSelectedTooltipElement();
|
295
|
+
const selectionParent = getSelectionParent();
|
296
|
+
|
297
|
+
// Hide the panel if:
|
298
|
+
//
|
299
|
+
// * the selection went out of the EXISTING link element. E.g. user moved the caret out
|
300
|
+
// of the link,
|
301
|
+
// * the selection went to a different parent when creating a NEW link. E.g. someone
|
302
|
+
// else modified the document.
|
303
|
+
// * the selection has expanded (e.g. displaying link actions then pressing SHIFT+Right arrow).
|
304
|
+
//
|
305
|
+
// Note: #_getSelectedTooltipElement will return a link for a non-collapsed selection only
|
306
|
+
// when fully selected.
|
307
|
+
if ((prevSelectedLink && !selectedLink) ||
|
308
|
+
(!prevSelectedLink && selectionParent !== prevSelectionParent)) {
|
309
|
+
this._hideUI();
|
310
|
+
}
|
311
|
+
// Update the position of the panel when:
|
312
|
+
// * link panel is in the visible stack
|
313
|
+
// * the selection remains in the original link element,
|
314
|
+
// * there was no link element in the first place, i.e. creating a new link
|
315
|
+
else if (this._isUIVisible) {
|
316
|
+
// If still in a link element, simply update the position of the balloon.
|
317
|
+
// If there was no link (e.g. inserting one), the balloon must be moved
|
318
|
+
// to the new position in the editing view (a new native DOM range).
|
319
|
+
this._balloon.updatePosition(this._getBalloonPositionData());
|
320
|
+
}
|
321
|
+
|
322
|
+
prevSelectedLink = selectedLink;
|
323
|
+
prevSelectionParent = selectionParent;
|
324
|
+
};
|
325
|
+
|
326
|
+
function getSelectionParent() {
|
327
|
+
return viewDocument.selection.focus.getAncestors()
|
328
|
+
.reverse()
|
329
|
+
.find(node => node.is('element'));
|
168
330
|
}
|
169
|
-
this.stopListening(this.editor.ui, 'update');
|
170
|
-
this._balloon.remove(this._actionView);
|
171
331
|
|
172
|
-
|
173
|
-
|
332
|
+
this.listenTo(editor.ui, 'update', update);
|
333
|
+
this.listenTo(this._balloon, 'change:visibleView', update);
|
334
|
+
}
|
335
|
+
|
336
|
+
get _areActionsInPanel() {
|
337
|
+
return this._balloon.hasView(this.actionsView);
|
338
|
+
}
|
339
|
+
|
340
|
+
get _areActionsVisible() {
|
341
|
+
return this._balloon.visibleView === this.actionsView;
|
342
|
+
}
|
343
|
+
|
344
|
+
get _isUIInPanel() {
|
345
|
+
return this._areActionsInPanel;
|
346
|
+
}
|
347
|
+
|
348
|
+
get _isUIVisible() {
|
349
|
+
const visibleView = this._balloon.visibleView;
|
350
|
+
|
351
|
+
return visibleView == this._areActionsVisible;
|
352
|
+
}
|
353
|
+
|
354
|
+
/**
|
355
|
+
* Returns positioning options for the {@link #_balloon}. They control the way the balloon is attached
|
356
|
+
* to the target element or selection.
|
357
|
+
*
|
358
|
+
* If the selection is collapsed and inside a link element, the panel will be attached to the
|
359
|
+
* entire link element. Otherwise, it will be attached to the selection.
|
360
|
+
*
|
361
|
+
* @private
|
362
|
+
* @returns {module:utils/dom/position~Options}
|
363
|
+
*/
|
364
|
+
_getBalloonPositionData() {
|
365
|
+
const view = this.editor.editing.view;
|
366
|
+
const model = this.editor.model;
|
367
|
+
const viewDocument = view.document;
|
368
|
+
let target = null;
|
369
|
+
|
370
|
+
if (model.markers.has(VISUAL_SELECTION_MARKER_NAME)) {
|
371
|
+
// There are cases when we highlight selection using a marker (#7705, #4721).
|
372
|
+
const markerViewElements = Array.from(this.editor.editing.mapper.markerNameToElements(VISUAL_SELECTION_MARKER_NAME));
|
373
|
+
const newRange = view.createRange(
|
374
|
+
view.createPositionBefore(markerViewElements[ 0 ]),
|
375
|
+
view.createPositionAfter(markerViewElements[ markerViewElements.length - 1 ])
|
376
|
+
);
|
377
|
+
|
378
|
+
target = view.domConverter.viewRangeToDom(newRange);
|
379
|
+
} else {
|
380
|
+
const targetLink = this._getSelectedTooltipElement();
|
381
|
+
const range = viewDocument.selection.getFirstRange();
|
382
|
+
|
383
|
+
target = targetLink ?
|
384
|
+
// When selection is inside link element, then attach panel to this element.
|
385
|
+
view.domConverter.mapViewToDom(targetLink) :
|
386
|
+
// Otherwise attach panel to the selection.
|
387
|
+
view.domConverter.viewRangeToDom(range);
|
174
388
|
}
|
389
|
+
|
390
|
+
return { target };
|
175
391
|
}
|
176
392
|
|
177
|
-
|
393
|
+
/**
|
394
|
+
* Returns the link {@link module:engine/view/attributeelement~AttributeElement} under
|
395
|
+
* the {@link module:engine/view/document~Document editing view's} selection or `null`
|
396
|
+
* if there is none.
|
397
|
+
*
|
398
|
+
* **Note**: For a non–collapsed selection, the link element is only returned when **fully**
|
399
|
+
* selected and the **only** element within the selection boundaries.
|
400
|
+
*
|
401
|
+
* @private
|
402
|
+
* @returns {module:engine/view/attributeelement~AttributeElement|null}
|
403
|
+
*/
|
404
|
+
_getSelectedTooltipElement() {
|
178
405
|
const view = this.editor.editing.view;
|
179
406
|
const selection = view.document.selection;
|
407
|
+
|
180
408
|
if (selection.isCollapsed) {
|
181
409
|
return findTooltipElementAncestor(selection.getFirstPosition());
|
182
|
-
}
|
183
|
-
else {
|
410
|
+
} else {
|
184
411
|
// The range for fully selected link is usually anchored in adjacent text nodes.
|
185
412
|
// Trim it to get closer to the actual link element.
|
186
413
|
const range = selection.getFirstRange().getTrimmed();
|
187
|
-
const
|
188
|
-
const
|
189
|
-
|
414
|
+
const startLink = findTooltipElementAncestor(range.start);
|
415
|
+
const endLink = findTooltipElementAncestor(range.end);
|
416
|
+
|
417
|
+
if (!startLink || startLink != endLink) {
|
190
418
|
return null;
|
191
419
|
}
|
192
420
|
|
193
421
|
// Check if the link element is fully selected.
|
194
|
-
if (view.createRangeIn(
|
195
|
-
return
|
196
|
-
}
|
197
|
-
else {
|
422
|
+
if (view.createRangeIn(startLink).getTrimmed().isEqual(range)) {
|
423
|
+
return startLink;
|
424
|
+
} else {
|
198
425
|
return null;
|
199
426
|
}
|
200
427
|
}
|
201
428
|
}
|
429
|
+
|
430
|
+
/**
|
431
|
+
* Displays a fake visual selection when the contextual balloon is displayed.
|
432
|
+
*
|
433
|
+
* This adds a 'link-ui' marker into the document that is rendered as a highlight on selected text fragment.
|
434
|
+
*
|
435
|
+
* @private
|
436
|
+
*/
|
437
|
+
_showFakeVisualSelection() {
|
438
|
+
const model = this.editor.model;
|
439
|
+
|
440
|
+
model.change(writer => {
|
441
|
+
const range = model.document.selection.getFirstRange();
|
442
|
+
|
443
|
+
if (model.markers.has(VISUAL_SELECTION_MARKER_NAME)) {
|
444
|
+
writer.updateMarker(VISUAL_SELECTION_MARKER_NAME, { range });
|
445
|
+
} else {
|
446
|
+
if (range.start.isAtEnd) {
|
447
|
+
const startPosition = range.start.getLastMatchingPosition(
|
448
|
+
({ item }) => !model.schema.isContent(item),
|
449
|
+
{ boundaries: range }
|
450
|
+
);
|
451
|
+
|
452
|
+
writer.addMarker(VISUAL_SELECTION_MARKER_NAME, {
|
453
|
+
usingOperation: false,
|
454
|
+
affectsData: false,
|
455
|
+
range: writer.createRange(startPosition, range.end)
|
456
|
+
});
|
457
|
+
} else {
|
458
|
+
writer.addMarker(VISUAL_SELECTION_MARKER_NAME, {
|
459
|
+
usingOperation: false,
|
460
|
+
affectsData: false,
|
461
|
+
range
|
462
|
+
});
|
463
|
+
}
|
464
|
+
}
|
465
|
+
});
|
466
|
+
}
|
467
|
+
|
468
|
+
/**
|
469
|
+
* Hides the fake visual selection created in {@link #_showFakeVisualSelection}.
|
470
|
+
*
|
471
|
+
* @private
|
472
|
+
*/
|
473
|
+
_hideFakeVisualSelection() {
|
474
|
+
const model = this.editor.model;
|
475
|
+
|
476
|
+
if (model.markers.has(VISUAL_SELECTION_MARKER_NAME)) {
|
477
|
+
model.change(writer => {
|
478
|
+
writer.removeMarker(VISUAL_SELECTION_MARKER_NAME);
|
479
|
+
});
|
480
|
+
}
|
481
|
+
}
|
482
|
+
}
|
483
|
+
|
484
|
+
// Returns a link element if there's one among the ancestors of the provided `Position`.
|
485
|
+
//
|
486
|
+
// @private
|
487
|
+
// @param {module:engine/view/position~Position} View position to analyze.
|
488
|
+
// @returns {module:engine/view/attributeelement~AttributeElement|null} Link element at the position or null.
|
489
|
+
function findTooltipElementAncestor(position) {
|
490
|
+
return position.getAncestors().find(ancestor => isTooltipElement(ancestor));
|
202
491
|
}
|
203
|
-
|