qms-angular 1.1.35 → 1.1.36
Sign up to get free protection for your applications and to get access to all the features.
- package/bundles/qms-angular.umd.js +6 -3
- package/bundles/qms-angular.umd.js.map +1 -1
- package/esm2015/lib/components/related/model/risk-danger.model.js +2 -1
- package/esm2015/lib/components/related/risk/list/list.component.js +4 -3
- package/esm2015/lib/components/select-department/select-department.component.js +2 -2
- package/esm2015/lib/components/select-department-tree/model/select-department-tree.config.js +2 -1
- package/fesm2015/qms-angular.js +6 -3
- package/fesm2015/qms-angular.js.map +1 -1
- package/lib/components/related/model/risk-danger.model.d.ts +1 -0
- package/lib/components/related/risk/list/list.component.d.ts +1 -0
- package/lib/components/select-department-tree/model/select-department-tree.config.d.ts +1 -0
- package/package.json +1 -1
- package/qms-angular.metadata.json +1 -1
- package/src/assets/qms-ckeditor-plugin/build/ckeditor.js +1 -1
- package/src/assets/qms-ckeditor-plugin/build/ckeditor.js.map +1 -1
- package/src/assets/qms-ckeditor-plugin/src/plugins/link/linkcommand.js +4 -0
- package/src/assets/qms-ckeditor-plugin/src/plugins/link/linkdialogcommand.js +66 -14
@@ -149,6 +149,10 @@ export default class LinkCommand extends Command {
|
|
149
149
|
* @param {Object} [manualDecoratorIds={}] The information about manual decorator attributes to be applied or removed upon execution.
|
150
150
|
*/
|
151
151
|
execute(options) {
|
152
|
+
if(!options) {
|
153
|
+
return;
|
154
|
+
}
|
155
|
+
|
152
156
|
const model = this.editor.model;
|
153
157
|
const selection = model.document.selection;
|
154
158
|
const manualDecoratorIds = {};
|
@@ -4,9 +4,10 @@ import { Collection, first } from '@ckeditor/ckeditor5-utils';
|
|
4
4
|
import * as QMSCKEditorConstant from '../common/qmsCKEditorConstant';
|
5
5
|
import * as QMSCKEditorEnum from '../common/qmsCKEditorEnum';
|
6
6
|
import * as QMSCKEditorService from '../common/qmsCKEditorService';
|
7
|
-
import { isImageAllowed } from './utils';
|
7
|
+
import { isImageAllowed, isLinkElement} from './utils';
|
8
8
|
import AutomaticDecorators from './utils/automaticdecorators';
|
9
|
-
|
9
|
+
import * as QMSCKEditorUtil from '../common/qmsCKEditorUtil';
|
10
|
+
|
10
11
|
export default class LinkDialogCommand extends Command {
|
11
12
|
constructor( editor ) {
|
12
13
|
super( editor );
|
@@ -48,18 +49,38 @@ import AutomaticDecorators from './utils/automaticdecorators';
|
|
48
49
|
const ranges = selection.getFirstRange();
|
49
50
|
|
50
51
|
let link = QMSCKEditorEnum.hyperLink;
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
52
|
+
|
53
|
+
let parentLink = this._getSelectedLinkElement();
|
54
|
+
|
55
|
+
if(parentLink) {
|
56
|
+
let linkOption = parentLink.getAttribute('url') || parentLink.getAttribute('option');
|
57
|
+
link.typeId = QMSCKEditorUtil.getLinkType(linkOption);
|
58
|
+
link.targetId = parentLink.getAttribute('target') ? QMSCKEditorEnum.targetEnum[parentLink.getAttribute('target')] : 0;
|
59
|
+
if (parentLink._children.length > 0) {
|
60
|
+
link.title = parentLink._children[0]._textData ? parentLink._children[0]._textData.trim() : '';
|
61
|
+
}
|
62
|
+
else {
|
63
|
+
link.title = '';
|
64
|
+
}
|
65
|
+
link.protocolId = QMSCKEditorUtil.getProtocolId(linkOption);
|
66
|
+
link.url = parentLink.getAttribute('href') || '';
|
67
|
+
link.edit = true;
|
68
|
+
link.ckeditorId = editor.id;
|
69
|
+
} else {
|
70
|
+
link.typeId = 0;
|
71
|
+
link.targetId = 0;
|
72
|
+
link.protocolId = 0;
|
73
|
+
link.url = '';
|
74
|
+
link.title = '';
|
75
|
+
link.editorContent = '';
|
76
|
+
link.ckeditorId = editor.id;
|
77
|
+
for (const item of ranges.getItems()) {
|
78
|
+
if (item.data) {
|
79
|
+
link.title = item.data;
|
80
|
+
}
|
81
|
+
}
|
82
|
+
}
|
83
|
+
|
63
84
|
QMSCKEditorService.linkNotify(link);
|
64
85
|
window[QMSCKEditorConstant.QMSCK_LINKED] = false;
|
65
86
|
window.addEventListener(QMSCKEditorConstant.QMSCK_LINK_PLUGIN_RESP, function(evt) {
|
@@ -88,4 +109,35 @@ import AutomaticDecorators from './utils/automaticdecorators';
|
|
88
109
|
|
89
110
|
return doc.selection.getAttribute( decoratorName );
|
90
111
|
}
|
112
|
+
|
113
|
+
_getSelectedLinkElement() {
|
114
|
+
const view = this.editor.editing.view;
|
115
|
+
const selection = view.document.selection;
|
116
|
+
|
117
|
+
if ( selection.isCollapsed ) {
|
118
|
+
return findLinkElementAncestor( selection.getFirstPosition() );
|
119
|
+
} else {
|
120
|
+
// The range for fully selected link is usually anchored in adjacent text nodes.
|
121
|
+
// Trim it to get closer to the actual link element.
|
122
|
+
const range = selection.getFirstRange().getTrimmed();
|
123
|
+
const startLink = findLinkElementAncestor( range.start );
|
124
|
+
const endLink = findLinkElementAncestor( range.end );
|
125
|
+
|
126
|
+
if ( !startLink || startLink != endLink ) {
|
127
|
+
return null;
|
128
|
+
}
|
129
|
+
|
130
|
+
// Check if the link element is fully selected.
|
131
|
+
if ( view.createRangeIn( startLink ).getTrimmed().isEqual( range ) ) {
|
132
|
+
return startLink;
|
133
|
+
} else {
|
134
|
+
return null;
|
135
|
+
}
|
136
|
+
}
|
137
|
+
}
|
138
|
+
|
91
139
|
}
|
140
|
+
|
141
|
+
function findLinkElementAncestor( position ) {
|
142
|
+
return position.getAncestors().find( ancestor => isLinkElement( ancestor ) );
|
143
|
+
}
|