qms-angular 1.0.39 → 1.0.40
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 +2845 -253
- package/bundles/qms-angular.umd.js.map +1 -1
- package/esm2015/lib/model/en.js +14 -1
- package/esm2015/lib/model/no.js +18 -5
- package/esm2015/lib/qms-ckeditor-components/common/constants/ckeditorEvent.constant.js +3 -1
- package/esm2015/lib/qms-ckeditor-components/common/constants/iconSvg.constants.js +8 -0
- package/esm2015/lib/qms-ckeditor-components/common/enums/image-mode.enum.js +9 -0
- package/esm2015/lib/qms-ckeditor-components/common/enums/protocol-type.enum.js +11 -3
- package/esm2015/lib/qms-ckeditor-components/common/enums/target-type.enum.js +8 -1
- package/esm2015/lib/qms-ckeditor-components/common/functions/common.function.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-input.model.js +1 -9
- package/esm2015/lib/qms-ckeditor-components/components/qms-ckeditor-imagemap/qms-ckeditor-imagemap.component.js +524 -0
- package/esm2015/lib/qms-ckeditor-components/components/qms-ckeditor-imagemap/qms-ckeditor-imagemap.lib.js +1948 -0
- package/esm2015/lib/qms-ckeditor-components/components/qms-ckeditor-imagemap/qms-ckeditor-imagemap.validator.js +7 -0
- package/esm2015/lib/qms-ckeditor-components/components/qms-ckeditor-link/qms-ckeditor-link.component.js +4 -4
- package/esm2015/lib/qms-ckeditor-components/models/qms-ckeditor-imagemap.model.js +22 -0
- package/esm2015/lib/qms-ckeditor-components/qms-ckeditor.component.js +45 -12
- package/esm2015/lib/qms-ckeditor-components/qms-ckeditor.module.js +11 -1
- package/esm2015/qms-angular.js +3 -1
- package/fesm2015/qms-angular.js +2822 -252
- package/fesm2015/qms-angular.js.map +1 -1
- package/lib/model/en.d.ts +13 -0
- package/lib/model/no.d.ts +13 -0
- package/lib/qms-ckeditor-components/common/constants/ckeditorEvent.constant.d.ts +2 -0
- package/lib/qms-ckeditor-components/common/constants/iconSvg.constants.d.ts +7 -0
- package/lib/qms-ckeditor-components/common/enums/image-mode.enum.d.ts +7 -0
- package/lib/qms-ckeditor-components/common/enums/protocol-type.enum.d.ts +9 -2
- package/lib/qms-ckeditor-components/common/enums/target-type.enum.d.ts +6 -0
- package/lib/qms-ckeditor-components/common/models/qms-ckeditor-data.model.d.ts +1 -0
- package/lib/qms-ckeditor-components/common/models/qms-ckeditor-input.model.d.ts +7 -7
- package/lib/qms-ckeditor-components/components/qms-ckeditor-imagemap/qms-ckeditor-imagemap.component.d.ts +123 -0
- package/lib/qms-ckeditor-components/components/qms-ckeditor-imagemap/qms-ckeditor-imagemap.lib.d.ts +542 -0
- package/lib/qms-ckeditor-components/components/qms-ckeditor-imagemap/qms-ckeditor-imagemap.validator.d.ts +2 -0
- package/lib/qms-ckeditor-components/models/qms-ckeditor-imagemap.model.d.ts +20 -0
- package/lib/qms-ckeditor-components/qms-ckeditor.component.d.ts +5 -4
- package/package.json +1 -1
- package/qms-angular.d.ts +2 -0
- package/qms-angular.metadata.json +1 -1
- package/src/assets/qms-ckeditor-plugin/build/ckeditor.js +2 -2
- package/src/assets/qms-ckeditor-plugin/build/ckeditor.js.map +1 -1
- package/src/assets/qms-ckeditor-plugin/package-lock.json +12177 -9
- package/src/assets/qms-ckeditor-plugin/src/ckeditor.js +3 -2
- package/src/assets/qms-ckeditor-plugin/src/plugins/common/qmsCKEditorConstant.js +4 -0
- package/src/assets/qms-ckeditor-plugin/src/plugins/common/qmsCKEditorService.js +10 -0
- package/src/assets/qms-ckeditor-plugin/src/plugins/fullscreen/dist/qmsCKEditorFullscreenPlugin.dev.js +87 -0
- package/src/assets/qms-ckeditor-plugin/src/plugins/imagemap/converters.js +378 -0
- package/src/assets/qms-ckeditor-plugin/src/plugins/imagemap/imagemap.js +14 -0
- package/src/assets/qms-ckeditor-plugin/src/plugins/imagemap/imagemapediting.js +183 -0
- package/src/assets/qms-ckeditor-plugin/src/plugins/imagemap/imagemapui.js +49 -0
- package/src/assets/qms-ckeditor-plugin/src/plugins/imagemap/insertimagemapcommand.js +127 -0
- package/src/assets/qms-ckeditor-plugin/src/plugins/imagemap/resizeimagemapcommand.js +82 -0
- package/src/assets/qms-ckeditor-plugin/src/plugins/imagemap/utils.js +234 -0
- package/src/assets/qms-ckeditor-plugin/src/plugins/link/linkediting.js +1 -1
- package/src/assets/qms-ckeditor-plugin/src/plugins/link/linkimage.js +1 -1
- package/src/assets/qms-ckeditor-plugin/src/plugins/link/ui/linkactionsview.js +1 -1
- package/src/assets/qms-ckeditor-plugin/src/plugins/link/ui/linkformview.js +1 -1
- package/src/assets/qms-ckeditor-plugin/src/plugins/tooltip/inserttooltipcommand.js +1 -1
- package/src/assets/qms-ckeditor-plugin/src/plugins/tooltip/tooltipediting.js +1 -1
- package/src/assets/qms-ckeditor-plugin/src/plugins/tooltip/ui/actionsview.js +1 -1
- package/src/assets/qms-ckeditor-plugin/src/themes/icons/imagemap.svg +56 -0
- package/src/assets/qms-ckeditor-plugin/src/themes/{tyles → styles}/anchor.css +0 -0
- package/src/assets/qms-ckeditor-plugin/src/themes/{tyles → styles}/link.css +0 -0
- package/src/assets/qms-ckeditor-plugin/src/themes/{tyles → styles}/linkactions.css +0 -0
- package/src/assets/qms-ckeditor-plugin/src/themes/{tyles → styles}/linkform.css +0 -0
- package/src/assets/qms-ckeditor-plugin/src/themes/{tyles → styles}/linkimage.css +0 -0
- package/src/assets/qms-ckeditor-plugin/src/themes/{tyles → styles}/tooltip.css +0 -0
- package/src/lib/qms-ckeditor-components/components/qms-ckeditor-imagemap/qms-ckeditor-imagemap.component.scss +27 -0
- package/src/themes/_color.scss +8 -0
- package/src/themes/core/_colors.scss +2 -0
- package/src/themes/core/_tab.scss +50 -49
@@ -1,8 +1,8 @@
|
|
1
1
|
(function (global, factory) {
|
2
|
-
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@angular/core'), require('rxjs'), require('@angular/common'), require('@angular/forms'), require('@angular/material/form-field'), require('@angular/material/radio'), require('@angular/material/dialog'), require('@angular/material/autocomplete'), require('@angular/cdk/overlay'), require('@angular/cdk/portal'), require('@angular/material/input'), require('@angular/material/card'), require('@angular/material/icon'), require('@angular/material/core'), require('@angular/material/progress-spinner'), require('@angular/cdk/a11y'), require('@angular/cdk/coercion'), require('@angular/cdk/collections'), require('@angular/platform-browser/animations'), require('moment'), require('@angular/material/list'), require('@angular/material/expansion'), require('@angular/material/button'), require('@angular/cdk/scrolling'), require('@angular/material/checkbox'), require('@angular/material/sidenav'), require('@angular/material/tree'), require('@angular/material/menu'), require('@angular/platform-browser'), require('rxjs/operators'), require('@angular/cdk/tree'), require('@angular/common/http'), require('@angular/material/select'), require('@angular/material/snack-bar'), require('@ckeditor/ckeditor5-angular'), require('jquery'), require('lodash'), require('@angular/material/
|
3
|
-
typeof define === 'function' && define.amd ? define('qms-angular', ['exports', '@angular/core', 'rxjs', '@angular/common', '@angular/forms', '@angular/material/form-field', '@angular/material/radio', '@angular/material/dialog', '@angular/material/autocomplete', '@angular/cdk/overlay', '@angular/cdk/portal', '@angular/material/input', '@angular/material/card', '@angular/material/icon', '@angular/material/core', '@angular/material/progress-spinner', '@angular/cdk/a11y', '@angular/cdk/coercion', '@angular/cdk/collections', '@angular/platform-browser/animations', 'moment', '@angular/material/list', '@angular/material/expansion', '@angular/material/button', '@angular/cdk/scrolling', '@angular/material/checkbox', '@angular/material/sidenav', '@angular/material/tree', '@angular/material/menu', '@angular/platform-browser', 'rxjs/operators', '@angular/cdk/tree', '@angular/common/http', '@angular/material/select', '@angular/material/snack-bar', '@ckeditor/ckeditor5-angular', 'jquery', 'lodash', '@angular/material/
|
4
|
-
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global['qms-angular'] = {}, global.ng.core, global.rxjs, global.ng.common, global.ng.forms, global.ng.material.formField, global.ng.material.radio, global.ng.material.dialog, global.ng.material.autocomplete, global.ng.cdk.overlay, global.ng.cdk.portal, global.ng.material.input, global.ng.material.card, global.ng.material.icon, global.ng.material.core, global.ng.material.progressSpinner, global.ng.cdk.a11y, global.ng.cdk.coercion, global.ng.cdk.collections, global.ng.platformBrowser.animations, global.moment, global.ng.material.list, global.ng.material.expansion, global.ng.material.button, global.ng.cdk.scrolling, global.ng.material.checkbox, global.ng.material.sidenav, global.ng.material.tree, global.ng.material.menu, global.ng.platformBrowser, global.rxjs.operators, global.ng.cdk.tree, global.ng.common.http, global.ng.material.select, global.ng.material.snackBar, global.ckeditor5Angular, global.$, global._, global.ng.material.
|
5
|
-
}(this, (function (exports, i0, rxjs, common, forms, formField, radio, dialog, autocomplete, overlay, portal, input, card, icon, core, progressSpinner, a11y, coercion, collections, animations, moment, list, expansion, button, scrolling, checkbox, sidenav, tree$1, menu, platformBrowser, operators, tree, i1, select, snackBar, ckeditor5Angular, $, _,
|
2
|
+
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@angular/core'), require('rxjs'), require('@angular/common'), require('@angular/forms'), require('@angular/material/form-field'), require('@angular/material/radio'), require('@angular/material/dialog'), require('@angular/material/autocomplete'), require('@angular/cdk/overlay'), require('@angular/cdk/portal'), require('@angular/material/input'), require('@angular/material/card'), require('@angular/material/icon'), require('@angular/material/core'), require('@angular/material/progress-spinner'), require('@angular/cdk/a11y'), require('@angular/cdk/coercion'), require('@angular/cdk/collections'), require('@angular/platform-browser/animations'), require('moment'), require('@angular/material/list'), require('@angular/material/expansion'), require('@angular/material/button'), require('@angular/cdk/scrolling'), require('@angular/material/checkbox'), require('@angular/material/sidenav'), require('@angular/material/tree'), require('@angular/material/menu'), require('@angular/platform-browser'), require('rxjs/operators'), require('@angular/cdk/tree'), require('@angular/common/http'), require('@angular/material/button-toggle'), require('@angular/material/select'), require('@angular/material/snack-bar'), require('@ckeditor/ckeditor5-angular'), require('jquery'), require('lodash'), require('@angular/material/tooltip'), require('@angular/material/badge'), require('@angular/material/toolbar'), require('@angular/cdk/stepper'), require('@angular/material/stepper')) :
|
3
|
+
typeof define === 'function' && define.amd ? define('qms-angular', ['exports', '@angular/core', 'rxjs', '@angular/common', '@angular/forms', '@angular/material/form-field', '@angular/material/radio', '@angular/material/dialog', '@angular/material/autocomplete', '@angular/cdk/overlay', '@angular/cdk/portal', '@angular/material/input', '@angular/material/card', '@angular/material/icon', '@angular/material/core', '@angular/material/progress-spinner', '@angular/cdk/a11y', '@angular/cdk/coercion', '@angular/cdk/collections', '@angular/platform-browser/animations', 'moment', '@angular/material/list', '@angular/material/expansion', '@angular/material/button', '@angular/cdk/scrolling', '@angular/material/checkbox', '@angular/material/sidenav', '@angular/material/tree', '@angular/material/menu', '@angular/platform-browser', 'rxjs/operators', '@angular/cdk/tree', '@angular/common/http', '@angular/material/button-toggle', '@angular/material/select', '@angular/material/snack-bar', '@ckeditor/ckeditor5-angular', 'jquery', 'lodash', '@angular/material/tooltip', '@angular/material/badge', '@angular/material/toolbar', '@angular/cdk/stepper', '@angular/material/stepper'], factory) :
|
4
|
+
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global['qms-angular'] = {}, global.ng.core, global.rxjs, global.ng.common, global.ng.forms, global.ng.material.formField, global.ng.material.radio, global.ng.material.dialog, global.ng.material.autocomplete, global.ng.cdk.overlay, global.ng.cdk.portal, global.ng.material.input, global.ng.material.card, global.ng.material.icon, global.ng.material.core, global.ng.material.progressSpinner, global.ng.cdk.a11y, global.ng.cdk.coercion, global.ng.cdk.collections, global.ng.platformBrowser.animations, global.moment, global.ng.material.list, global.ng.material.expansion, global.ng.material.button, global.ng.cdk.scrolling, global.ng.material.checkbox, global.ng.material.sidenav, global.ng.material.tree, global.ng.material.menu, global.ng.platformBrowser, global.rxjs.operators, global.ng.cdk.tree, global.ng.common.http, global.ng.material.buttonToggle, global.ng.material.select, global.ng.material.snackBar, global.ckeditor5Angular, global.$, global._, global.ng.material.tooltip, global.ng.material.badge, global.ng.material.toolbar, global.ng.cdk.stepper, global.ng.material.stepper));
|
5
|
+
}(this, (function (exports, i0, rxjs, common, forms, formField, radio, dialog, autocomplete, overlay, portal, input, card, icon, core, progressSpinner, a11y, coercion, collections, animations, moment, list, expansion, button, scrolling, checkbox, sidenav, tree$1, menu, platformBrowser, operators, tree, i1, buttonToggle, select, snackBar, ckeditor5Angular, $, _, tooltip, badge, toolbar, stepper$1, stepper) { 'use strict';
|
6
6
|
|
7
7
|
function _interopNamespace(e) {
|
8
8
|
if (e && e.__esModule) return e;
|
@@ -92,6 +92,8 @@
|
|
92
92
|
"DOCUMENTS_IN": "Documents in"
|
93
93
|
},
|
94
94
|
"QMSCKEDITOR": {
|
95
|
+
"REMOVE_MAP": "Remove Map",
|
96
|
+
"IMAGE_MAP_PROPERTIES": "Image Map Properties",
|
95
97
|
"INSERT_TOOLTIP": "Insert a tooltip",
|
96
98
|
"CONTENT": "Content",
|
97
99
|
"TEMPLATE": "Template",
|
@@ -113,6 +115,7 @@
|
|
113
115
|
"CANCEL": "Cancel",
|
114
116
|
"LINK": "Link",
|
115
117
|
"LINK_TYPE": "Link type",
|
118
|
+
"ZOOM": "Zoom",
|
116
119
|
"LINK_URL": "URL",
|
117
120
|
"LINK_ANCHOR_IN_TEXT": "Link to anchor in the text",
|
118
121
|
"LINK_EMAIL": "Email",
|
@@ -150,6 +153,16 @@
|
|
150
153
|
"DOCUMENT": "Document",
|
151
154
|
"CONFIRM": "Confirm",
|
152
155
|
"SEARCH": "Search",
|
156
|
+
"IMAGE_MODE_POINTER": "Pointer",
|
157
|
+
"IMAGE_MODE_RECTANGLE": "Rectangle",
|
158
|
+
"IMAGE_MODE_CIRCLE": "Circle",
|
159
|
+
"IMAGE_MODE_POLYGON": "Polygon",
|
160
|
+
"IMAGE_MODE_REMOVE": "Remove",
|
161
|
+
"POLYGON_DRAW": "Use SHIFT + click for the last control point",
|
162
|
+
"RECTANGLE_DRAW": "Hold down SHIFT for square mode",
|
163
|
+
"SQUARE_DRAW": "Release SHIFT for rectangle mode",
|
164
|
+
"INVALID_URL": "Invalid URL",
|
165
|
+
"REQUIRED_URL": "URL is required"
|
153
166
|
},
|
154
167
|
"BPMN": {
|
155
168
|
"DEFAULT": "Default",
|
@@ -336,6 +349,8 @@
|
|
336
349
|
"DOCUMENTS_IN": "Dokumenter i"
|
337
350
|
},
|
338
351
|
"QMSCKEDITOR": {
|
352
|
+
"REMOVE_MAP": "Fjern kartet",
|
353
|
+
"IMAGE_MAP_PROPERTIES": "Bilde Kart Egenskaper",
|
339
354
|
"INSERT_TOOLTIP": "Sett inn et verktøytips",
|
340
355
|
"CONTENT": "Innhold",
|
341
356
|
"TEMPLATE": "Mal",
|
@@ -357,6 +372,7 @@
|
|
357
372
|
"CANCEL": "Avbryt",
|
358
373
|
"LINK": "Link",
|
359
374
|
"LINK_TYPE": "Koblingstype",
|
375
|
+
"ZOOM": "Zoom",
|
360
376
|
"LINK_URL": "URL",
|
361
377
|
"LINK_ANCHOR_IN_TEXT": "Lenke til anker i teksten",
|
362
378
|
"LINK_EMAIL": "E-post",
|
@@ -367,10 +383,10 @@
|
|
367
383
|
"TARGET_SAME": "Samme vindu (selv)",
|
368
384
|
"TARGET_PARENT": "Overordnet vindu (_parent)",
|
369
385
|
"PROTOCOL": "Protocol",
|
370
|
-
"PROTOCOL_HTTP": "http
|
371
|
-
"PROTOCOL_HTTPS": "https
|
372
|
-
"PROTOCOL_FTP": "ftp
|
373
|
-
"PROTOCOL_NEW": "nyheter
|
386
|
+
"PROTOCOL_HTTP": "http://",
|
387
|
+
"PROTOCOL_HTTPS": "https://",
|
388
|
+
"PROTOCOL_FTP": "ftp://",
|
389
|
+
"PROTOCOL_NEW": "nyheter://",
|
374
390
|
"PROTOCOL_OTHER": "<other>",
|
375
391
|
"ADVISORY_TITLE": "Rådgivende tittel",
|
376
392
|
"HANDBOOK": "eHandbook",
|
@@ -394,6 +410,16 @@
|
|
394
410
|
"DOCUMENT": "Dokument",
|
395
411
|
"CONFIRM": "Bekreft",
|
396
412
|
"SEARCH": "Søk",
|
413
|
+
"IMAGE_MODE_POINTER": "Peker",
|
414
|
+
"IMAGE_MODE_RECTANGLE": "Rektangel",
|
415
|
+
"IMAGE_MODE_CIRCLE": "Sirkel",
|
416
|
+
"IMAGE_MODE_POLYGON": "Polygon",
|
417
|
+
"IMAGE_MODE_REMOVE": "Ta bort",
|
418
|
+
"POLYGON_DRAW": "Bruk SKIFT + klikk for det siste kontrollpunktet",
|
419
|
+
"RECTANGLE_DRAW": "Hold nede SKIFT for kvadratisk modus",
|
420
|
+
"SQUARE_DRAW": "Slipp SKIFT for rektangelmodus",
|
421
|
+
"INVALID_URL": "Ugyldig URL",
|
422
|
+
"REQUIRED_URL": "URL er påkrevd"
|
397
423
|
},
|
398
424
|
"BPMN": {
|
399
425
|
"DEFAULT": "Standard",
|
@@ -6856,10 +6882,18 @@
|
|
6856
6882
|
(function (ProtocolType) {
|
6857
6883
|
ProtocolType[ProtocolType["http"] = 0] = "http";
|
6858
6884
|
ProtocolType[ProtocolType["https"] = 1] = "https";
|
6859
|
-
ProtocolType[ProtocolType["
|
6860
|
-
ProtocolType[ProtocolType["
|
6885
|
+
ProtocolType[ProtocolType["ftp"] = 2] = "ftp";
|
6886
|
+
ProtocolType[ProtocolType["news"] = 3] = "news";
|
6861
6887
|
ProtocolType[ProtocolType["other"] = 4] = "other";
|
6862
|
-
})(exports.ProtocolType || (exports.ProtocolType = {}));
|
6888
|
+
})(exports.ProtocolType || (exports.ProtocolType = {}));
|
6889
|
+
exports.ProtocolTypeName = void 0;
|
6890
|
+
(function (ProtocolTypeName) {
|
6891
|
+
ProtocolTypeName["http"] = "http://";
|
6892
|
+
ProtocolTypeName["https"] = "https://";
|
6893
|
+
ProtocolTypeName["ftp"] = "ftp://";
|
6894
|
+
ProtocolTypeName["news"] = "news://";
|
6895
|
+
ProtocolTypeName["other"] = "";
|
6896
|
+
})(exports.ProtocolTypeName || (exports.ProtocolTypeName = {}));
|
6863
6897
|
|
6864
6898
|
exports.TargetType = void 0;
|
6865
6899
|
(function (TargetType) {
|
@@ -6867,7 +6901,14 @@
|
|
6867
6901
|
TargetType[TargetType["topmost"] = 1] = "topmost";
|
6868
6902
|
TargetType[TargetType["same"] = 2] = "same";
|
6869
6903
|
TargetType[TargetType["parent"] = 3] = "parent";
|
6870
|
-
})(exports.TargetType || (exports.TargetType = {}));
|
6904
|
+
})(exports.TargetType || (exports.TargetType = {}));
|
6905
|
+
exports.TargetTypeName = void 0;
|
6906
|
+
(function (TargetTypeName) {
|
6907
|
+
TargetTypeName["new"] = "_blank";
|
6908
|
+
TargetTypeName["topmost"] = "_top";
|
6909
|
+
TargetTypeName["same"] = "_self";
|
6910
|
+
TargetTypeName["parent"] = "_parent";
|
6911
|
+
})(exports.TargetTypeName || (exports.TargetTypeName = {}));
|
6871
6912
|
|
6872
6913
|
var QMSCKEditorRelation = /** @class */ (function () {
|
6873
6914
|
function QMSCKEditorRelation() {
|
@@ -7398,8 +7439,8 @@
|
|
7398
7439
|
if (this.protocols) {
|
7399
7440
|
this.protocols.push({ id: exports.ProtocolType.http, name: this.LANG.QMSCKEDITOR.PROTOCOL_HTTP });
|
7400
7441
|
this.protocols.push({ id: exports.ProtocolType.https, name: this.LANG.QMSCKEDITOR.PROTOCOL_HTTPS });
|
7401
|
-
this.protocols.push({ id: exports.ProtocolType.
|
7402
|
-
this.protocols.push({ id: exports.ProtocolType.
|
7442
|
+
this.protocols.push({ id: exports.ProtocolType.ftp, name: this.LANG.QMSCKEDITOR.PROTOCOL_FTP });
|
7443
|
+
this.protocols.push({ id: exports.ProtocolType.news, name: this.LANG.QMSCKEDITOR.PROTOCOL_NEW });
|
7403
7444
|
this.protocols.push({ id: exports.ProtocolType.other, name: this.LANG.QMSCKEDITOR.PROTOCOL_OTHER });
|
7404
7445
|
}
|
7405
7446
|
};
|
@@ -7625,7 +7666,7 @@
|
|
7625
7666
|
QMSCKEditorLinkComponent.decorators = [
|
7626
7667
|
{ type: i0.Component, args: [{
|
7627
7668
|
selector: 'qms-ckeditor-link',
|
7628
|
-
template: "<div id=\"qmsckeditor_link\" class=\"qmsckeditor qmsckeditor__link__container\">\r\n <div id=\"qmsckeditor_link_header\">\r\n <span\r\n id=\"qmsckeditor_link_header_001\"\r\n mat-icon-button\r\n class=\"qmsckeditor button__close\"\r\n (click)=\"onCloseDialog()\"\r\n >\r\n <mat-icon>close</mat-icon>\r\n </span>\r\n <div id=\"qmsckeditor_link_header_002\" mat-dialog-content>\r\n <h2 id=\"qmsckeditor_link_header_001\">\r\n {{ LANG.QMSCKEDITOR.LINK }}\r\n </h2>\r\n </div>\r\n </div>\r\n <div id=\"qmsckeditor_link_type\" class=\"row\">\r\n <mat-form-field appearance=\"fill\" class=\"col-12 pl-3 pr-3\">\r\n <mat-label>{{ LANG.QMSCKEDITOR.LINK_TYPE }}</mat-label>\r\n <mat-select\r\n disableOptionCentering\r\n name=\"linkTypeList\"\r\n [(ngModel)]=\"selectedLink\"\r\n (ngModelChange)=\"onSelectedLinkType()\"\r\n >\r\n <mat-option *ngFor=\"let link of linkTypes\" [value]=\"link.id\">\r\n {{ link.name }}\r\n </mat-option>\r\n </mat-select>\r\n </mat-form-field>\r\n </div>\r\n\r\n <div id=\"qmsckeditor_link_content\">\r\n <form\r\n [formGroup]=\"linkFormGroup\"\r\n class=\"qmsckeditor link__content height row\"\r\n *ngIf=\"selectedLink === 0\"\r\n >\r\n <div id=\"qmsckeditor_link_url\" class=\"col-12 mt-1 pl-3 pr-3\">\r\n <mat-expansion-panel\r\n id=\"qmsckeditor_link_url_panel\"\r\n [expanded]=\"isExpanded\"\r\n (opened)=\"isExpanded = true\"\r\n (closed)=\"isExpanded = false\"\r\n >\r\n <mat-expansion-panel-header>\r\n <mat-panel-title>\r\n {{ LANG.QMSCKEDITOR.URL_HEADER }}\r\n </mat-panel-title>\r\n </mat-expansion-panel-header>\r\n <div id=\"qmsckeditor_link_url_001\" class=\"row mt-2\">\r\n <mat-form-field appearance=\"fill\" class=\"col-12 pl-3 pr-\">\r\n <mat-label>{{ LANG.QMSCKEDITOR.TARGET }}</mat-label>\r\n <mat-select\r\n [(ngModel)]=\"selectedTarget\"\r\n formControlName=\"targetList\"\r\n disableOptionCentering\r\n >\r\n <mat-option *ngFor=\"let target of targets\" [value]=\"target.id\">\r\n {{ target.name }}\r\n </mat-option>\r\n </mat-select>\r\n </mat-form-field>\r\n </div>\r\n <div id=\"qmsckeditor_link_url_002\" class=\"row\">\r\n <mat-form-field appearance=\"fill\" class=\"col-12 pl-3 pr-3\">\r\n <mat-label>{{ LANG.QMSCKEDITOR.PROTOCOL }}</mat-label>\r\n <mat-select\r\n [(ngModel)]=\"selectedProtocol\"\r\n formControlName=\"protocolList\"\r\n disableOptionCentering\r\n >\r\n <mat-option\r\n *ngFor=\"let protocol of protocols\"\r\n [value]=\"protocol.id\"\r\n >\r\n {{ protocol.name }}\r\n </mat-option>\r\n </mat-select>\r\n </mat-form-field>\r\n </div>\r\n <div id=\"qmsckeditor_link_url_003\" class=\"row\">\r\n <mat-form-field class=\"col-12 pl-3 pr-3\" appearance=\"fill\">\r\n <mat-label>{{ LANG.QMSCKEDITOR.LINK_URL }}</mat-label>\r\n <input matInput [(ngModel)]=\"url\" formControlName=\"url\" />\r\n <mat-error\r\n *ngIf=\"linkFormGroup.get('url').hasError('required')\"\r\n class=\"mt5\"\r\n >\r\n </mat-error>\r\n </mat-form-field>\r\n </div>\r\n <div id=\"qmsckeditor_link_url_004\" class=\"row\">\r\n <mat-form-field class=\"col-12 pl-3 pr-3\" appearance=\"fill\">\r\n <mat-label>{{ LANG.QMSCKEDITOR.ADVISORY_TITLE }}</mat-label>\r\n <input\r\n matInput\r\n [(ngModel)]=\"advisoryTitle\"\r\n formControlName=\"advisoryTitle\"\r\n />\r\n <mat-error\r\n *ngIf=\"linkFormGroup.get('advisoryTitle').hasError('required')\"\r\n class=\"mt5\"\r\n >\r\n </mat-error>\r\n </mat-form-field>\r\n </div>\r\n <div\r\n id=\"qmsckeditor_link_url_005\"\r\n class=\"qmsckeditor button__groups row\"\r\n >\r\n <div class=\"col-6 pl-3\">\r\n <button\r\n class=\"save\"\r\n mat-flat-button\r\n (click)=\"eHandbook(false, false)\"\r\n >\r\n {{ LANG.QMSCKEDITOR.HANDBOOK }}\r\n </button>\r\n </div>\r\n <div class=\"col-6 pr-3\">\r\n <button class=\"save\" mat-flat-button (click)=\"attachment()\">\r\n {{ LANG.QMSCKEDITOR.ATTACHMENT }}\r\n </button>\r\n </div>\r\n </div>\r\n </mat-expansion-panel>\r\n </div>\r\n </form>\r\n\r\n <form\r\n [formGroup]=\"anchorTextFormGroup\"\r\n class=\"qmsckeditor link__content height row\"\r\n *ngIf=\"selectedLink === 1\"\r\n >\r\n <div id=\"qmsckeditor_link_anchor_text\" class=\"col-12 mt-1 pl-3 pr-3\">\r\n <mat-expansion-panel\r\n id=\"qmsckeditor_link_anchor_text_panel\"\r\n [expanded]=\"isExpanded\"\r\n (opened)=\"isExpanded = true\"\r\n (closed)=\"isExpanded = false\"\r\n >\r\n <mat-expansion-panel-header>\r\n <mat-panel-title>\r\n {{ LANG.QMSCKEDITOR.ANCHOR_TEXT_HEADER }}\r\n </mat-panel-title>\r\n </mat-expansion-panel-header>\r\n <div id=\"qmsckeditor_link_anchor_text_001\" class=\"row mt-2\">\r\n <mat-form-field appearance=\"fill\" class=\"col-12 pl-3 pr-\">\r\n <mat-label>{{ LANG.QMSCKEDITOR.ANCHOR_BY_NAME }}</mat-label>\r\n <mat-select [(ngModel)]=\"anchorText\" formControlName=\"anchorText\">\r\n <mat-option\r\n *ngFor=\"let editorAnchor of editorAnchors\"\r\n [value]=\"editorAnchor.anchorValue\"\r\n disableOptionCentering\r\n >\r\n {{ editorAnchor.viewValue }}\r\n </mat-option>\r\n </mat-select>\r\n <mat-error\r\n *ngIf=\"\r\n anchorTextFormGroup.get('anchorText').hasError('required')\r\n \"\r\n class=\"mt5\"\r\n >\r\n </mat-error>\r\n </mat-form-field>\r\n </div>\r\n </mat-expansion-panel>\r\n </div>\r\n </form>\r\n\r\n <form\r\n [formGroup]=\"emailFormGroup\"\r\n class=\"qmsckeditor link__content height row\"\r\n *ngIf=\"selectedLink === 2\"\r\n >\r\n <div id=\"qmsckeditor_link_email\" class=\"col-12 mt-1 pl-3 pr-3\">\r\n <mat-expansion-panel\r\n id=\"qmsckeditor_link_email_panel\"\r\n [expanded]=\"isExpanded\"\r\n (opened)=\"isExpanded = true\"\r\n (closed)=\"isExpanded = false\"\r\n >\r\n <mat-expansion-panel-header>\r\n <mat-panel-title>\r\n {{ LANG.QMSCKEDITOR.EMAIL_HEADER }}\r\n </mat-panel-title>\r\n </mat-expansion-panel-header>\r\n <div id=\"qmsckeditor_link_email_001\" class=\"row\">\r\n <mat-form-field class=\"col-12 pl-3 pr-3\" appearance=\"fill\">\r\n <mat-label>{{ LANG.QMSCKEDITOR.EMAIL_ADDRESS }}</mat-label>\r\n <input\r\n matInput\r\n [(ngModel)]=\"emailAddress\"\r\n formControlName=\"emailAddress\"\r\n />\r\n <mat-error\r\n *ngIf=\"emailFormGroup.get('emailAddress').hasError('required')\"\r\n class=\"mt5\"\r\n >\r\n </mat-error>\r\n </mat-form-field>\r\n </div>\r\n <div id=\"qmsckeditor_link_email_002\" class=\"row\">\r\n <mat-form-field class=\"col-12 pl-3 pr-3\" appearance=\"fill\">\r\n <mat-label>{{ LANG.QMSCKEDITOR.EMAIL_SUBJECT }}</mat-label>\r\n <input\r\n matInput\r\n [(ngModel)]=\"emailSubject\"\r\n formControlName=\"emailSubject\"\r\n />\r\n <mat-error\r\n *ngIf=\"emailFormGroup.get('emailSubject').hasError('required')\"\r\n class=\"mt5\"\r\n >\r\n </mat-error>\r\n </mat-form-field>\r\n </div>\r\n <div id=\"qmsckeditor_link_email_003\" class=\"row\">\r\n <mat-form-field class=\"col-12 pl-3 pr-3\" appearance=\"fill\">\r\n <mat-label>{{ LANG.QMSCKEDITOR.EMAIL_BODY }}</mat-label>\r\n <textarea\r\n matInput\r\n [(ngModel)]=\"emailBody\"\r\n formControlName=\"emailBody\"\r\n ></textarea>\r\n <mat-error\r\n *ngIf=\"emailFormGroup.get('emailBody').hasError('required')\"\r\n class=\"mt5\"\r\n >\r\n </mat-error>\r\n </mat-form-field>\r\n </div>\r\n </mat-expansion-panel>\r\n </div>\r\n </form>\r\n\r\n <form\r\n [formGroup]=\"anchorDocFormGroup\"\r\n class=\"qmsckeditor link__content height row\"\r\n *ngIf=\"selectedLink === 3\"\r\n >\r\n <div id=\"qmsckeditor_link_anchor_doc\" class=\"col-12 mt-1 pl-3 pr-3\">\r\n <mat-expansion-panel\r\n id=\"qmsckeditor_link_email_panel\"\r\n [expanded]=\"isExpanded\"\r\n (opened)=\"isExpanded = true\"\r\n (closed)=\"isExpanded = false\"\r\n >\r\n <mat-expansion-panel-header>\r\n <mat-panel-title>\r\n {{ LANG.QMSCKEDITOR.EMAIL_HEADER }}\r\n </mat-panel-title>\r\n </mat-expansion-panel-header>\r\n <div\r\n id=\"qmsckeditor_link_anchor_doc_001\"\r\n class=\"qmsckeditor button__groups row\"\r\n >\r\n <div class=\"col-6 pl-3\">\r\n <button\r\n class=\"cancel\"\r\n mat-flat-button\r\n (click)=\"eHandbook(true, true)\"\r\n >\r\n {{ LANG.QMSCKEDITOR.HANDBOOK }}\r\n </button>\r\n </div>\r\n </div>\r\n <div id=\"qmsckeditor_link_anchor_doc_002\" class=\"row mt-4\">\r\n <mat-form-field class=\"col-12 pl-3 pr-3\" appearance=\"fill\">\r\n <mat-label>{{ LANG.QMSCKEDITOR.DOCUMENT }}</mat-label>\r\n <input\r\n matInput\r\n [(ngModel)]=\"anchorTitle\"\r\n formControlName=\"anchorTitle\"\r\n />\r\n <mat-error\r\n *ngIf=\"\r\n anchorDocFormGroup.get('anchorTitle').hasError('required')\r\n \"\r\n class=\"mt5\"\r\n >\r\n </mat-error>\r\n </mat-form-field>\r\n </div>\r\n <div id=\"qmsckeditor_link_anchor_doc_003\" class=\"row mt-2\">\r\n <mat-form-field appearance=\"fill\" class=\"col-12 pl-3 pr-\">\r\n <mat-label>{{ LANG.QMSCKEDITOR.ANCHOR_BY_NAME }}</mat-label>\r\n <mat-select\r\n [(ngModel)]=\"anchorByName\"\r\n formControlName=\"anchorByName\"\r\n disableOptionCentering\r\n >\r\n <mat-option\r\n *ngFor=\"let docAnchor of documentAnchors\"\r\n [value]=\"docAnchor.anchorValue\"\r\n >\r\n {{ docAnchor.viewValue }}\r\n </mat-option>\r\n </mat-select>\r\n <mat-error\r\n *ngIf=\"\r\n anchorDocFormGroup.get('anchorByName').hasError('required')\r\n \"\r\n class=\"mt5\"\r\n >\r\n </mat-error>\r\n </mat-form-field>\r\n </div>\r\n </mat-expansion-panel>\r\n </div>\r\n </form>\r\n </div>\r\n\r\n <div id=\"qmsckeditor_link_footer\" class=\"qmsckeditor button__groups row\">\r\n <div class=\"col-12 mt-3 pl-3 pr-3\">\r\n <button\r\n class=\"save\"\r\n mat-flat-button\r\n (click)=\"setLink()\"\r\n [disabled]=\"disableOkButton()\"\r\n >\r\n {{ LANG.QMSCKEDITOR.OK }}\r\n </button>\r\n </div>\r\n </div>\r\n</div>\r\n",
|
7669
|
+
template: "<div id=\"qmsckeditor_link\" class=\"qmsckeditor qmsckeditor__link__container\">\r\n <div id=\"qmsckeditor_link_header\">\r\n <span id=\"qmsckeditor_link_header_001\" mat-icon-button class=\"qmsckeditor button__close\" (click)=\"onCloseDialog()\">\r\n <mat-icon>close</mat-icon>\r\n </span>\r\n <div id=\"qmsckeditor_link_header_002\" mat-dialog-content>\r\n <h2 id=\"qmsckeditor_link_header_001\">\r\n {{ LANG.QMSCKEDITOR.LINK }}\r\n </h2>\r\n </div>\r\n </div>\r\n <div id=\"qmsckeditor_link_type\" class=\"row\">\r\n <mat-form-field appearance=\"fill\" class=\"col-12 pl-3 pr-3\">\r\n <mat-label>{{ LANG.QMSCKEDITOR.LINK_TYPE }}</mat-label>\r\n <mat-select disableOptionCentering name=\"linkTypeList\" [(ngModel)]=\"selectedLink\"\r\n (ngModelChange)=\"onSelectedLinkType()\">\r\n <mat-option *ngFor=\"let link of linkTypes\" [value]=\"link.id\">\r\n {{ link.name }}\r\n </mat-option>\r\n </mat-select>\r\n </mat-form-field>\r\n </div>\r\n\r\n <div id=\"qmsckeditor_link_content\">\r\n <form [formGroup]=\"linkFormGroup\" class=\"qmsckeditor link__content height row\" *ngIf=\"selectedLink === 0\">\r\n <div id=\"qmsckeditor_link_url\" class=\"col-12 mt-1 pl-3 pr-3\">\r\n <mat-expansion-panel id=\"qmsckeditor_link_url_panel\" [expanded]=\"isExpanded\" (opened)=\"isExpanded = true\"\r\n (closed)=\"isExpanded = false\">\r\n <mat-expansion-panel-header>\r\n <mat-panel-title>\r\n {{ LANG.QMSCKEDITOR.URL_HEADER }}\r\n </mat-panel-title>\r\n </mat-expansion-panel-header>\r\n <div id=\"qmsckeditor_link_url_001\" class=\"row mt-2\">\r\n <mat-form-field appearance=\"fill\" class=\"col-12 pl-3 pr-\">\r\n <mat-label>{{ LANG.QMSCKEDITOR.TARGET }}</mat-label>\r\n <mat-select [(ngModel)]=\"selectedTarget\" formControlName=\"targetList\" disableOptionCentering>\r\n <mat-option *ngFor=\"let target of targets\" [value]=\"target.id\">\r\n {{ target.name }}\r\n </mat-option>\r\n </mat-select>\r\n </mat-form-field>\r\n </div>\r\n <div id=\"qmsckeditor_link_url_002\" class=\"row\">\r\n <mat-form-field appearance=\"fill\" class=\"col-12 pl-3 pr-3\">\r\n <mat-label>{{ LANG.QMSCKEDITOR.PROTOCOL }}</mat-label>\r\n <mat-select [(ngModel)]=\"selectedProtocol\" formControlName=\"protocolList\" disableOptionCentering>\r\n <mat-option *ngFor=\"let protocol of protocols\" [value]=\"protocol.id\">\r\n {{ protocol.name }}\r\n </mat-option>\r\n </mat-select>\r\n </mat-form-field>\r\n </div>\r\n <div id=\"qmsckeditor_link_url_003\" class=\"row\">\r\n <mat-form-field class=\"col-12 pl-3 pr-3\" appearance=\"fill\">\r\n <mat-label>{{ LANG.QMSCKEDITOR.LINK_URL }}</mat-label>\r\n <input matInput [(ngModel)]=\"url\" name=\"url\" formControlName=\"url\" />\r\n <mat-error *ngIf=\"linkFormGroup.get('url').hasError('required')\" class=\"mt5\">\r\n </mat-error>\r\n </mat-form-field>\r\n </div>\r\n <div id=\"qmsckeditor_link_url_004\" class=\"row\">\r\n <mat-form-field class=\"col-12 pl-3 pr-3\" appearance=\"fill\">\r\n <mat-label>{{ LANG.QMSCKEDITOR.ADVISORY_TITLE }}</mat-label>\r\n <input matInput [(ngModel)]=\"advisoryTitle\" formControlName=\"advisoryTitle\" />\r\n <mat-error *ngIf=\"linkFormGroup.get('advisoryTitle').hasError('required')\" class=\"mt5\">\r\n </mat-error>\r\n </mat-form-field>\r\n </div>\r\n <div id=\"qmsckeditor_link_url_005\" class=\"qmsckeditor button__groups row\">\r\n <div class=\"col-6 pl-3\">\r\n <button class=\"save\" mat-flat-button (click)=\"eHandbook(false, false)\">\r\n {{ LANG.QMSCKEDITOR.HANDBOOK }}\r\n </button>\r\n </div>\r\n <div class=\"col-6 pr-3\">\r\n <button class=\"save\" mat-flat-button (click)=\"attachment()\">\r\n {{ LANG.QMSCKEDITOR.ATTACHMENT }}\r\n </button>\r\n </div>\r\n </div>\r\n </mat-expansion-panel>\r\n </div>\r\n </form>\r\n\r\n <form [formGroup]=\"anchorTextFormGroup\" class=\"qmsckeditor link__content height row\" *ngIf=\"selectedLink === 1\">\r\n <div id=\"qmsckeditor_link_anchor_text\" class=\"col-12 mt-1 pl-3 pr-3\">\r\n <mat-expansion-panel id=\"qmsckeditor_link_anchor_text_panel\" [expanded]=\"isExpanded\"\r\n (opened)=\"isExpanded = true\" (closed)=\"isExpanded = false\">\r\n <mat-expansion-panel-header>\r\n <mat-panel-title>\r\n {{ LANG.QMSCKEDITOR.ANCHOR_TEXT_HEADER }}\r\n </mat-panel-title>\r\n </mat-expansion-panel-header>\r\n <div id=\"qmsckeditor_link_anchor_text_001\" class=\"row mt-2\">\r\n <mat-form-field appearance=\"fill\" class=\"col-12 pl-3 pr-\">\r\n <mat-label>{{ LANG.QMSCKEDITOR.ANCHOR_BY_NAME }}</mat-label>\r\n <mat-select [(ngModel)]=\"anchorText\" formControlName=\"anchorText\">\r\n <mat-option *ngFor=\"let editorAnchor of editorAnchors\" [value]=\"editorAnchor.anchorValue\"\r\n disableOptionCentering>\r\n {{ editorAnchor.viewValue }}\r\n </mat-option>\r\n </mat-select>\r\n <mat-error *ngIf=\"\r\n anchorTextFormGroup.get('anchorText').hasError('required')\r\n \" class=\"mt5\">\r\n </mat-error>\r\n </mat-form-field>\r\n </div>\r\n </mat-expansion-panel>\r\n </div>\r\n </form>\r\n\r\n <form [formGroup]=\"emailFormGroup\" class=\"qmsckeditor link__content height row\" *ngIf=\"selectedLink === 2\">\r\n <div id=\"qmsckeditor_link_email\" class=\"col-12 mt-1 pl-3 pr-3\">\r\n <mat-expansion-panel id=\"qmsckeditor_link_email_panel\" [expanded]=\"isExpanded\" (opened)=\"isExpanded = true\"\r\n (closed)=\"isExpanded = false\">\r\n <mat-expansion-panel-header>\r\n <mat-panel-title>\r\n {{ LANG.QMSCKEDITOR.EMAIL_HEADER }}\r\n </mat-panel-title>\r\n </mat-expansion-panel-header>\r\n <div id=\"qmsckeditor_link_email_001\" class=\"row\">\r\n <mat-form-field class=\"col-12 pl-3 pr-3\" appearance=\"fill\">\r\n <mat-label>{{ LANG.QMSCKEDITOR.EMAIL_ADDRESS }}</mat-label>\r\n <input matInput [(ngModel)]=\"emailAddress\" formControlName=\"emailAddress\" />\r\n <mat-error *ngIf=\"emailFormGroup.get('emailAddress').hasError('required')\" class=\"mt5\">\r\n </mat-error>\r\n </mat-form-field>\r\n </div>\r\n <div id=\"qmsckeditor_link_email_002\" class=\"row\">\r\n <mat-form-field class=\"col-12 pl-3 pr-3\" appearance=\"fill\">\r\n <mat-label>{{ LANG.QMSCKEDITOR.EMAIL_SUBJECT }}</mat-label>\r\n <input matInput [(ngModel)]=\"emailSubject\" formControlName=\"emailSubject\" />\r\n <mat-error *ngIf=\"emailFormGroup.get('emailSubject').hasError('required')\" class=\"mt5\">\r\n </mat-error>\r\n </mat-form-field>\r\n </div>\r\n <div id=\"qmsckeditor_link_email_003\" class=\"row\">\r\n <mat-form-field class=\"col-12 pl-3 pr-3\" appearance=\"fill\">\r\n <mat-label>{{ LANG.QMSCKEDITOR.EMAIL_BODY }}</mat-label>\r\n <textarea matInput [(ngModel)]=\"emailBody\" formControlName=\"emailBody\"></textarea>\r\n <mat-error *ngIf=\"emailFormGroup.get('emailBody').hasError('required')\" class=\"mt5\">\r\n </mat-error>\r\n </mat-form-field>\r\n </div>\r\n </mat-expansion-panel>\r\n </div>\r\n </form>\r\n\r\n <form [formGroup]=\"anchorDocFormGroup\" class=\"qmsckeditor link__content height row\" *ngIf=\"selectedLink === 3\">\r\n <div id=\"qmsckeditor_link_anchor_doc\" class=\"col-12 mt-1 pl-3 pr-3\">\r\n <mat-expansion-panel id=\"qmsckeditor_link_email_panel\" [expanded]=\"isExpanded\" (opened)=\"isExpanded = true\"\r\n (closed)=\"isExpanded = false\">\r\n <mat-expansion-panel-header>\r\n <mat-panel-title>\r\n {{ LANG.QMSCKEDITOR.EMAIL_HEADER }}\r\n </mat-panel-title>\r\n </mat-expansion-panel-header>\r\n <div id=\"qmsckeditor_link_anchor_doc_001\" class=\"qmsckeditor button__groups row\">\r\n <div class=\"col-6 pl-3\">\r\n <button class=\"cancel\" mat-flat-button (click)=\"eHandbook(true, true)\">\r\n {{ LANG.QMSCKEDITOR.HANDBOOK }}\r\n </button>\r\n </div>\r\n </div>\r\n <div id=\"qmsckeditor_link_anchor_doc_002\" class=\"row mt-4\">\r\n <mat-form-field class=\"col-12 pl-3 pr-3\" appearance=\"fill\">\r\n <mat-label>{{ LANG.QMSCKEDITOR.DOCUMENT }}</mat-label>\r\n <input matInput [(ngModel)]=\"anchorTitle\" formControlName=\"anchorTitle\" />\r\n <mat-error *ngIf=\"\r\n anchorDocFormGroup.get('anchorTitle').hasError('required')\r\n \" class=\"mt5\">\r\n </mat-error>\r\n </mat-form-field>\r\n </div>\r\n <div id=\"qmsckeditor_link_anchor_doc_003\" class=\"row mt-2\">\r\n <mat-form-field appearance=\"fill\" class=\"col-12 pl-3 pr-\">\r\n <mat-label>{{ LANG.QMSCKEDITOR.ANCHOR_BY_NAME }}</mat-label>\r\n <mat-select [(ngModel)]=\"anchorByName\" formControlName=\"anchorByName\" disableOptionCentering>\r\n <mat-option *ngFor=\"let docAnchor of documentAnchors\" [value]=\"docAnchor.anchorValue\">\r\n {{ docAnchor.viewValue }}\r\n </mat-option>\r\n </mat-select>\r\n <mat-error *ngIf=\"\r\n anchorDocFormGroup.get('anchorByName').hasError('required')\r\n \" class=\"mt5\">\r\n </mat-error>\r\n </mat-form-field>\r\n </div>\r\n </mat-expansion-panel>\r\n </div>\r\n </form>\r\n </div>\r\n\r\n <div id=\"qmsckeditor_link_footer\" class=\"qmsckeditor button__groups row\">\r\n <div class=\"col-12 mt-3 pl-3 pr-3\">\r\n <button class=\"save\" mat-flat-button (click)=\"setLink()\" [disabled]=\"disableOkButton()\">\r\n {{ LANG.QMSCKEDITOR.OK }}\r\n </button>\r\n </div>\r\n </div>\r\n</div>",
|
7629
7670
|
styles: [".mt5{margin-top:5px!important}.mt10{margin-top:10px!important}.mt7{margin-top:7px!important}.mt15{margin-top:15px!important}.mt20{margin-top:20px!important}.mt30{margin-top:30px!important}.mt40{margin-top:40px!important}.ml2{margin-left:2px!important}.ml3{margin-left:3px!important}.ml5{margin-left:5px!important}.ml15{margin-left:15px!important}.ml10{margin-left:10px!important}.ml12{margin-left:12px!important}.ml16{margin-left:16px!important}.ml-auto{margin-left:auto!important}.ml-25{margin-left:-25px!important}.mr5{margin-right:5px!important}.mr12{margin-right:12px!important}.mr15{margin-right:15px!important}.mb5{margin-bottom:5px!important}.mb10{margin-bottom:10px!important}.mb15{margin-bottom:15px!important}.pt8{padding-top:8px!important}.pt10{padding-top:10px!important}.pt15{padding-top:15px!important}.pt16{padding-top:16px!important}.pl15{padding-left:15px!important}.pl0{padding-left:0!important}.pr0{padding-right:0!important}.pr15{padding-right:15px!important}.fs12{font-size:12px}.fs14{font-size:14px!important}.fs16{font-size:16px!important}.fs22{font-size:22px!important}.fw500{font-weight:500!important}.italic-text{font-style:italic}.display-flex{display:flex}.qmsckeditor{font-family:Roboto,Helvetica Neue,sans-serif;font-size:14px;font-weight:400}.qmsckeditor h2{font-size:20px;font-weight:400}.qmsckeditor .mat-dialog-content{padding:0}.qmsckeditor .mat-icon{color:#909497}.qmsckeditor__fullscreen{position:fixed;top:0;left:0;right:0;bottom:0;background:#fff;overflow-y:auto;max-height:100vh;overflow-x:hidden}.qmsckeditor__cursor{cursor:pointer}.qmsckeditor__notallowed{cursor:not-allowed}.qmsckeditor.button__close,.qmsckeditor.button__done{float:right;top:-24px;right:-24px;cursor:pointer}.qmsckeditor.button__done{margin-right:20px}.qmsckeditor.button__done .mat-icon{color:#28a745;font-weight:700}.qmsckeditor.button__groups button{min-height:40px;width:100%;border-radius:4px;border:1px solid #c5c5c5;font-family:Open Sans;font-weight:600;font-size:14px;letter-spacing:1px;line-height:16px}.qmsckeditor.button__groups .save{background:#f8f9f9}.qmsckeditor.button__groups .save:hover{background:#e5e7e9}.qmsckeditor.button__groups .save:disabled{cursor:not-allowed}.qmsckeditor.button__groups .cancel{background:#f8f9f9}.qmsckeditor.button__groups .cancel:hover{background:#e5e7e9}.qmsckeditor.button__groups .cancel:disabled{cursor:not-allowed}.qmsckeditor.button__groups .delete{background:#f8f9f9}.qmsckeditor.button__groups .delete:hover{background:#e5e7e9}.qmsckeditor.button__groups .delete:disabled{cursor:not-allowed}.qmsckeditor.confirm__button__groups button{min-height:36px;border-radius:4px;width:auto;border:1px solid #c5c5c5;font-family:Open Sans;font-weight:600;font-size:14px;letter-spacing:1px;line-height:16px;padding-left:15px;padding-right:15px}.qmsckeditor.confirm__button__groups .confirm{background:#f8f9f9}.qmsckeditor.confirm__button__groups .confirm:hover{background:#e5e7e9}.qmsckeditor.confirm__button__groups .cancel{background:#f8f9f9}.qmsckeditor.confirm__button__groups .cancel:hover{background:#e5e7e9}.qmsckeditor.template-content.height{min-height:420px;max-height:520px;overflow:auto}.qmsckeditor.template-content.title{margin-left:-9px}.qmsckeditor.link__content.height{min-height:400px;max-height:520px}.qmsckeditor.card{margin-bottom:10px;min-height:60px;box-shadow:none;border:1px solid #e5e5e5}.qmsckeditor.card .title{font-weight:700}.qmsckeditor.card .content{text-overflow:ellipsis;overflow:hidden;white-space:nowrap}.qmsckeditor.card .material-icons{font-size:20px}.qmsckeditor.tooltip-content.height{min-height:400px;max-height:470px;overflow:auto}.qmsckeditor.save__as__template.height{height:125px}.ck-content .page-break{width:100%}.qmsckeditor__link__container textarea.mat-input-element{min-height:130px}"]
|
7630
7671
|
},] }
|
7631
7672
|
];
|
@@ -8131,6 +8172,8 @@
|
|
8131
8172
|
CKEditorEventConst.QMSCK_LINK_PLUGIN_RESP = 'QMSCK_LINK_PLUGIN_RESP';
|
8132
8173
|
CKEditorEventConst.QMSCK_TOOLTIP_PLUGIN_MSG = 'QMSCK_TOOLTIP_PLUGIN_MSG';
|
8133
8174
|
CKEditorEventConst.QMSCK_TOOLTIP_PLUGIN_RESP = 'QMSCK_TOOLTIP_PLUGIN_RESP';
|
8175
|
+
CKEditorEventConst.QMSCK_IMAGEMAP_PLUGIN_MSG = 'QMSCK_IMAGEMAP_PLUGIN_MSG';
|
8176
|
+
CKEditorEventConst.QMSCK_IMAGEMAP_PLUGIN_RESP = 'QMSCK_IMAGEMAP_PLUGIN_RESP';
|
8134
8177
|
CKEditorEventConst.QMSCK_BPMN_PLUGIN_MSG = 'QMSCK_BPMN_PLUGIN_MSG';
|
8135
8178
|
CKEditorEventConst.QMSCK_BPMN_PLUGIN_RESP = 'QMSCK_BPMN_PLUGIN_RESP';
|
8136
8179
|
CKEditorEventConst.QMSCK_BPMN = 'bpmn';
|
@@ -8163,6 +8206,8 @@
|
|
8163
8206
|
'|',
|
8164
8207
|
'linkImage',
|
8165
8208
|
'|',
|
8209
|
+
'imageMap',
|
8210
|
+
'|',
|
8166
8211
|
'qmsBpmn'
|
8167
8212
|
],
|
8168
8213
|
resizeOptions: [
|
@@ -8405,87 +8450,6 @@
|
|
8405
8450
|
getCKEditorConfiguration: getCKEditorConfiguration
|
8406
8451
|
};
|
8407
8452
|
|
8408
|
-
var QMSCKEditorTooltip = /** @class */ (function () {
|
8409
|
-
function QMSCKEditorTooltip() {
|
8410
|
-
this.text = '';
|
8411
|
-
this.content = '';
|
8412
|
-
}
|
8413
|
-
return QMSCKEditorTooltip;
|
8414
|
-
}());
|
8415
|
-
|
8416
|
-
var QMSCKEditorTooltipComponent = /** @class */ (function (_super) {
|
8417
|
-
__extends(QMSCKEditorTooltipComponent, _super);
|
8418
|
-
function QMSCKEditorTooltipComponent(cdr, translate, dialogRef, data) {
|
8419
|
-
var _this = _super.call(this) || this;
|
8420
|
-
_this.cdr = cdr;
|
8421
|
-
_this.translate = translate;
|
8422
|
-
_this.dialogRef = dialogRef;
|
8423
|
-
_this.data = data;
|
8424
|
-
_this.tooltipFormGroup = new forms.FormGroup({
|
8425
|
-
title: new forms.FormControl('', [forms.Validators.required]),
|
8426
|
-
content: new forms.FormControl('', [forms.Validators.required])
|
8427
|
-
});
|
8428
|
-
_this.tooltip = { text: data.text, content: data.content };
|
8429
|
-
_this.editor = data.ckEditor;
|
8430
|
-
return _this;
|
8431
|
-
}
|
8432
|
-
QMSCKEditorTooltipComponent.prototype.ngOnInit = function () {
|
8433
|
-
var _this = this;
|
8434
|
-
this.translate.getLanguageSubject$.pipe(operators.takeUntil(this.ngUnsubcribe)).subscribe(function (res) {
|
8435
|
-
if (res) {
|
8436
|
-
_this.LANG = _this.translate.getObjectLang(res);
|
8437
|
-
}
|
8438
|
-
});
|
8439
|
-
this.editorConfig = CKEditorCommonFunctions.getCKEditorConfiguration(',heading,|,fontsize,fontfamily,fontColor,fontBackgroundColor,|,bold,italic,underline,strikethrough,|,alignment,|,bulletedList,numberedList,|,outdent,indent,|,subscript,superscript,|,undo,redo,|,specialCharacters,blockQuote,insertTable,|,link,anchor,|,timestamp,|,removeformat');
|
8440
|
-
};
|
8441
|
-
QMSCKEditorTooltipComponent.prototype.ngAfterViewChecked = function () {
|
8442
|
-
this.cdr.detectChanges();
|
8443
|
-
};
|
8444
|
-
QMSCKEditorTooltipComponent.prototype.onCloseDialog = function () {
|
8445
|
-
this.dialogRef.close();
|
8446
|
-
};
|
8447
|
-
QMSCKEditorTooltipComponent.prototype.getOutputContent = function (content) {
|
8448
|
-
this.tooltip.content = content;
|
8449
|
-
};
|
8450
|
-
QMSCKEditorTooltipComponent.prototype.onChanged = function (_a) {
|
8451
|
-
var editor = _a.editor;
|
8452
|
-
this.tooltip.content = editor.getData();
|
8453
|
-
};
|
8454
|
-
QMSCKEditorTooltipComponent.prototype.onBlur = function (_a) {
|
8455
|
-
var editor = _a.editor;
|
8456
|
-
this.tooltip.content = editor.getData();
|
8457
|
-
};
|
8458
|
-
QMSCKEditorTooltipComponent.prototype.onReady = function (editor) {
|
8459
|
-
if (this.tooltip.text) {
|
8460
|
-
editor.setData(this.tooltip.text);
|
8461
|
-
}
|
8462
|
-
editor.ui.getEditableElement().parentElement.insertBefore(editor.ui.view.toolbar.element, editor.ui.getEditableElement());
|
8463
|
-
};
|
8464
|
-
QMSCKEditorTooltipComponent.prototype.saveTooltip = function () {
|
8465
|
-
var tooltip = new QMSCKEditorTooltip();
|
8466
|
-
tooltip.content = this.tooltip.content;
|
8467
|
-
tooltip.text = this.tooltip.text;
|
8468
|
-
this.dialogRef.close(tooltip);
|
8469
|
-
};
|
8470
|
-
QMSCKEditorTooltipComponent.prototype.cancelTooltip = function () {
|
8471
|
-
this.dialogRef.close();
|
8472
|
-
};
|
8473
|
-
return QMSCKEditorTooltipComponent;
|
8474
|
-
}(QMSCKEditorBaseComponent));
|
8475
|
-
QMSCKEditorTooltipComponent.decorators = [
|
8476
|
-
{ type: i0.Component, args: [{
|
8477
|
-
selector: 'app-qmsck-tooltip',
|
8478
|
-
template: "<div\r\n id=\"qmsckeditor-tooltip\"\r\n class=\"qmsckeditor qmsckeditor__tooltip__container\"\r\n>\r\n <div id=\"qmsckeditor-tooltip-header\">\r\n <span\r\n id=\"qmsckeditor-tooltip-header_001\"\r\n mat-icon-button\r\n class=\"qmsckeditor button__close\"\r\n (click)=\"onCloseDialog()\"\r\n >\r\n <mat-icon>close</mat-icon>\r\n </span>\r\n <div id=\"qmsckeditor-tooltip-header_002\" mat-dialog-content>\r\n <h2 id=\"qmsckeditor-tooltip_002_001\">\r\n {{ LANG.QMSCKEDITOR.INSERT_TOOLTIP }}\r\n </h2>\r\n </div>\r\n </div>\r\n <form [formGroup]=\"tooltipFormGroup\">\r\n <div\r\n id=\"qmsckeditor-tooltip-content\"\r\n class=\"qmsckeditor tooltip-content height\"\r\n >\r\n <div id=\"qmsckeditor-tooltip-content_001\" class=\"col-12 mt-1 pl-2 pr-2\">\r\n <mat-expansion-panel\r\n id=\"qmsckeditor-tooltip-panel\"\r\n [expanded]=\"true\"\r\n (opened)=\"(true)\"\r\n (closed)=\"(false)\"\r\n >\r\n <div id=\"qmsckeditor-tooltip-panel_001\">\r\n <div id=\"qmsckeditor-tooltip-panel_001_001\">\r\n <mat-form-field class=\"col-12 pl-0 pr-0\" appearance=\"fill\">\r\n <mat-label>{{ LANG.QMSCKEDITOR.TITLE }}</mat-label>\r\n <input\r\n matInput\r\n [(ngModel)]=\"tooltip.text\"\r\n formControlName=\"title\"\r\n />\r\n </mat-form-field>\r\n </div>\r\n <div id=\"qmsckeditor-tooltip-panel_001_002\">\r\n <mat-label>{{ LANG.QMSCKEDITOR.CONTENT }}</mat-label>\r\n <div class=\"qmsckeditor_container col-12 pl-0 pr-0\">\r\n <ckeditor\r\n class=\"qms-ckeditor\"\r\n [(editor)]=\"editor\"\r\n [config]=\"editorConfig\"\r\n (ready)=\"onReady($event)\"\r\n [(ngModel)]=\"tooltip.content\"\r\n (change)=\"onChanged($event)\"\r\n (blur)=\"onBlur($event)\"\r\n formControlName=\"content\"\r\n >\r\n </ckeditor>\r\n </div>\r\n </div>\r\n <div\r\n id=\"qmsckeditor-tooltip-panel_001_003\"\r\n class=\"qmsckeditor button__groups row mr-0 ml-0 mt-4\"\r\n >\r\n <div class=\"col-6 pr-0\">\r\n <button\r\n class=\"save\"\r\n mat-flat-button\r\n (click)=\"saveTooltip()\"\r\n [disabled]=\"tooltipFormGroup.invalid\"\r\n >\r\n {{ LANG.QMSCKEDITOR.SAVE }}\r\n </button>\r\n </div>\r\n <div class=\"col-6 pl-0\">\r\n <button\r\n class=\"cancel\"\r\n mat-flat-button\r\n (click)=\"cancelTooltip()\"\r\n >\r\n {{ LANG.QMSCKEDITOR.CANCEL }}\r\n </button>\r\n </div>\r\n </div>\r\n </div>\r\n </mat-expansion-panel>\r\n </div>\r\n </div>\r\n </form>\r\n</div>\r\n",
|
8479
|
-
styles: [".mt5{margin-top:5px!important}.mt10{margin-top:10px!important}.mt7{margin-top:7px!important}.mt15{margin-top:15px!important}.mt20{margin-top:20px!important}.mt30{margin-top:30px!important}.mt40{margin-top:40px!important}.ml2{margin-left:2px!important}.ml3{margin-left:3px!important}.ml5{margin-left:5px!important}.ml15{margin-left:15px!important}.ml10{margin-left:10px!important}.ml12{margin-left:12px!important}.ml16{margin-left:16px!important}.ml-auto{margin-left:auto!important}.ml-25{margin-left:-25px!important}.mr5{margin-right:5px!important}.mr12{margin-right:12px!important}.mr15{margin-right:15px!important}.mb5{margin-bottom:5px!important}.mb10{margin-bottom:10px!important}.mb15{margin-bottom:15px!important}.pt8{padding-top:8px!important}.pt10{padding-top:10px!important}.pt15{padding-top:15px!important}.pt16{padding-top:16px!important}.pl15{padding-left:15px!important}.pl0{padding-left:0!important}.pr0{padding-right:0!important}.pr15{padding-right:15px!important}.fs12{font-size:12px}.fs14{font-size:14px!important}.fs16{font-size:16px!important}.fs22{font-size:22px!important}.fw500{font-weight:500!important}.italic-text{font-style:italic}.display-flex{display:flex}.qmsckeditor{font-family:Roboto,Helvetica Neue,sans-serif;font-size:14px;font-weight:400}.qmsckeditor h2{font-size:20px;font-weight:400}.qmsckeditor .mat-dialog-content{padding:0}.qmsckeditor .mat-icon{color:#909497}.qmsckeditor__fullscreen{position:fixed;top:0;left:0;right:0;bottom:0;background:#fff;overflow-y:auto;max-height:100vh;overflow-x:hidden}.qmsckeditor__cursor{cursor:pointer}.qmsckeditor__notallowed{cursor:not-allowed}.qmsckeditor.button__close,.qmsckeditor.button__done{float:right;top:-24px;right:-24px;cursor:pointer}.qmsckeditor.button__done{margin-right:20px}.qmsckeditor.button__done .mat-icon{color:#28a745;font-weight:700}.qmsckeditor.button__groups button{min-height:40px;width:100%;border-radius:4px;border:1px solid #c5c5c5;font-family:Open Sans;font-weight:600;font-size:14px;letter-spacing:1px;line-height:16px}.qmsckeditor.button__groups .save{background:#f8f9f9}.qmsckeditor.button__groups .save:hover{background:#e5e7e9}.qmsckeditor.button__groups .save:disabled{cursor:not-allowed}.qmsckeditor.button__groups .cancel{background:#f8f9f9}.qmsckeditor.button__groups .cancel:hover{background:#e5e7e9}.qmsckeditor.button__groups .cancel:disabled{cursor:not-allowed}.qmsckeditor.button__groups .delete{background:#f8f9f9}.qmsckeditor.button__groups .delete:hover{background:#e5e7e9}.qmsckeditor.button__groups .delete:disabled{cursor:not-allowed}.qmsckeditor.confirm__button__groups button{min-height:36px;border-radius:4px;width:auto;border:1px solid #c5c5c5;font-family:Open Sans;font-weight:600;font-size:14px;letter-spacing:1px;line-height:16px;padding-left:15px;padding-right:15px}.qmsckeditor.confirm__button__groups .confirm{background:#f8f9f9}.qmsckeditor.confirm__button__groups .confirm:hover{background:#e5e7e9}.qmsckeditor.confirm__button__groups .cancel{background:#f8f9f9}.qmsckeditor.confirm__button__groups .cancel:hover{background:#e5e7e9}.qmsckeditor.template-content.height{min-height:420px;max-height:520px;overflow:auto}.qmsckeditor.template-content.title{margin-left:-9px}.qmsckeditor.link__content.height{min-height:400px;max-height:520px}.qmsckeditor.card{margin-bottom:10px;min-height:60px;box-shadow:none;border:1px solid #e5e5e5}.qmsckeditor.card .title{font-weight:700}.qmsckeditor.card .content{text-overflow:ellipsis;overflow:hidden;white-space:nowrap}.qmsckeditor.card .material-icons{font-size:20px}.qmsckeditor.tooltip-content.height{min-height:400px;max-height:470px;overflow:auto}.qmsckeditor.save__as__template.height{height:125px}.ck-content .page-break,.qmsckeditor__tooltip__container .mat-form-field{width:100%}.qmsckeditor__tooltip__container textarea.mat-input-element{min-height:150px}"]
|
8480
|
-
},] }
|
8481
|
-
];
|
8482
|
-
QMSCKEditorTooltipComponent.ctorParameters = function () { return [
|
8483
|
-
{ type: i0.ChangeDetectorRef },
|
8484
|
-
{ type: TranslateLibraryService },
|
8485
|
-
{ type: dialog.MatDialogRef },
|
8486
|
-
{ type: QMSCKEditorTooltip, decorators: [{ type: i0.Inject, args: [dialog.MAT_DIALOG_DATA,] }] }
|
8487
|
-
]; };
|
8488
|
-
|
8489
8453
|
var FlowChartConst = /** @class */ (function () {
|
8490
8454
|
function FlowChartConst() {
|
8491
8455
|
}
|
@@ -12424,159 +12388,2757 @@
|
|
12424
12388
|
onMessage: [{ type: i0.HostListener, args: ['window:message', ['$event'],] }]
|
12425
12389
|
};
|
12426
12390
|
|
12427
|
-
var
|
12428
|
-
|
12429
|
-
|
12430
|
-
|
12431
|
-
|
12432
|
-
|
12433
|
-
|
12434
|
-
|
12435
|
-
|
12436
|
-
|
12437
|
-
_this.renderer = renderer;
|
12438
|
-
_this.elRef = elRef;
|
12439
|
-
_this.required = false;
|
12440
|
-
_this.qmsckContentOutput = new i0.EventEmitter();
|
12441
|
-
_this.ckEditorEventConst = CKEditorEventConst;
|
12442
|
-
return _this;
|
12391
|
+
var QMSCKEditorImageMap = /** @class */ (function () {
|
12392
|
+
function QMSCKEditorImageMap() {
|
12393
|
+
this.name = '';
|
12394
|
+
this.imageUrl = '';
|
12395
|
+
this.areas = [];
|
12396
|
+
this.entityId = '';
|
12397
|
+
this.editorContent = '';
|
12398
|
+
this.imageHeight = 0;
|
12399
|
+
this.imageWidth = 0;
|
12400
|
+
this.linkJavaScriptLinksAllowed = true;
|
12443
12401
|
}
|
12444
|
-
|
12445
|
-
|
12446
|
-
|
12447
|
-
|
12448
|
-
|
12449
|
-
|
12450
|
-
|
12451
|
-
|
12452
|
-
|
12453
|
-
|
12454
|
-
|
12455
|
-
|
12456
|
-
|
12457
|
-
|
12458
|
-
|
12459
|
-
|
12460
|
-
|
12461
|
-
|
12462
|
-
|
12463
|
-
|
12464
|
-
|
12465
|
-
|
12466
|
-
|
12467
|
-
|
12468
|
-
|
12469
|
-
|
12470
|
-
|
12471
|
-
|
12472
|
-
|
12473
|
-
|
12474
|
-
|
12475
|
-
|
12476
|
-
|
12477
|
-
|
12478
|
-
|
12479
|
-
|
12480
|
-
|
12481
|
-
|
12482
|
-
|
12483
|
-
|
12484
|
-
|
12485
|
-
|
12486
|
-
|
12487
|
-
|
12488
|
-
|
12489
|
-
|
12490
|
-
|
12491
|
-
|
12492
|
-
|
12493
|
-
|
12494
|
-
|
12495
|
-
|
12496
|
-
|
12497
|
-
|
12498
|
-
|
12499
|
-
|
12500
|
-
|
12501
|
-
|
12402
|
+
return QMSCKEditorImageMap;
|
12403
|
+
}());
|
12404
|
+
var QMSCKEditorImageArea = /** @class */ (function () {
|
12405
|
+
function QMSCKEditorImageArea() {
|
12406
|
+
this.shape = '';
|
12407
|
+
this.coords = '';
|
12408
|
+
this.alt = '';
|
12409
|
+
this.href = '';
|
12410
|
+
this.target = '';
|
12411
|
+
}
|
12412
|
+
return QMSCKEditorImageArea;
|
12413
|
+
}());
|
12414
|
+
|
12415
|
+
var ImageModeName;
|
12416
|
+
(function (ImageModeName) {
|
12417
|
+
ImageModeName["Pointer"] = "pointer";
|
12418
|
+
ImageModeName["Rectangle"] = "rect";
|
12419
|
+
ImageModeName["Circle"] = "circle";
|
12420
|
+
ImageModeName["Polygon"] = "poly";
|
12421
|
+
ImageModeName["Remove"] = "remove";
|
12422
|
+
})(ImageModeName || (ImageModeName = {}));
|
12423
|
+
|
12424
|
+
var IconSvg = /** @class */ (function () {
|
12425
|
+
function IconSvg() {
|
12426
|
+
}
|
12427
|
+
return IconSvg;
|
12428
|
+
}());
|
12429
|
+
IconSvg.VECTOR_POINTER = "<svg xmlns=\"http://www.w3.org/2000/svg\" xmlns:xlink=\"http://www.w3.org/1999/xlink\" version=\"1.1\" width=\"24\" height=\"24\" viewBox=\"0 0 24 24\"><path fill=\"#000000\" d=\"M13.75,10.19L14.38,10.32L18.55,12.4C19.25,12.63 19.71,13.32 19.65,14.06V14.19L19.65,14.32L18.75,20.44C18.69,20.87 18.5,21.27 18.15,21.55C17.84,21.85 17.43,22 17,22H10.12C9.63,22 9.18,21.82 8.85,21.47L2.86,15.5L3.76,14.5C4,14.25 4.38,14.11 4.74,14.13H5.03L9,15V4.5A2,2 0 0,1 11,2.5A2,2 0 0,1 13,4.5V10.19H13.75Z\" /></svg>";
|
12430
|
+
IconSvg.VECTOR_RECTANGLE = "<svg xmlns=\"http://www.w3.org/2000/svg\" xmlns:xlink=\"http://www.w3.org/1999/xlink\" version=\"1.1\" width=\"24\" height=\"24\" viewBox=\"0 0 24 24\"><path fill=\"#000000\" d=\"M2,2H8V4H16V2H22V8H20V16H22V22H16V20H8V22H2V16H4V8H2V2M16,8V6H8V8H6V16H8V18H16V16H18V8H16M4,4V6H6V4H4M18,4V6H20V4H18M4,18V20H6V18H4M18,18V20H20V18H18Z\" /></svg>";
|
12431
|
+
IconSvg.VECTOR_CIRCLE = "<svg xmlns=\"http://www.w3.org/2000/svg\" xmlns:xlink=\"http://www.w3.org/1999/xlink\" version=\"1.1\" width=\"24\" height=\"24\" viewBox=\"0 0 24 24\"><path fill=\"#000000\" d=\"M9,2V4.06C6.72,4.92 4.92,6.72 4.05,9H2V15H4.06C4.92,17.28 6.72,19.09 9,19.95V22H15V19.94C17.28,19.08 19.09,17.28 19.95,15H22V9H19.94C19.08,6.72 17.28,4.92 15,4.05V2M11,4H13V6H11M9,6.25V8H15V6.25C16.18,6.86 17.14,7.82 17.75,9H16V15H17.75C17.14,16.18 16.18,17.14 15,17.75V16H9V17.75C7.82,17.14 6.86,16.18 6.25,15H8V9H6.25C6.86,7.82 7.82,6.86 9,6.25M4,11H6V13H4M18,11H20V13H18M11,18H13V20H11\" /></svg>";
|
12432
|
+
IconSvg.VECTOR_POLYGON = "<svg xmlns=\"http://www.w3.org/2000/svg\" xmlns:xlink=\"http://www.w3.org/1999/xlink\" version=\"1.1\" width=\"24\" height=\"24\" viewBox=\"0 0 24 24\"><path fill=\"#000000\" d=\"M2,2V8H4.28L5.57,16H4V22H10V20.06L15,20.05V22H21V16H19.17L20,9H22V3H16V6.53L14.8,8H9.59L8,5.82V2M4,4H6V6H4M18,5H20V7H18M6.31,8H7.11L9,10.59V14H15V10.91L16.57,9H18L17.16,16H15V18.06H10V16H7.6M11,10H13V12H11M6,18H8V20H6M17,18H19V20H17\" /></svg>";
|
12433
|
+
IconSvg.VECTOR_REMOVE = "<svg width=\"24px\" height=\"24px\" viewBox=\"0 0 24 24\" role=\"img\" xmlns=\"http://www.w3.org/2000/svg\" stroke=\"#000000\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\" fill=\"none\" color=\"#000000\"><path fill=\"#000000\" d=\"M17,12 L7,12\"/> <circle cx=\"12\" cy=\"12\" r=\"10\"/> </svg>";
|
12434
|
+
|
12435
|
+
/**
|
12436
|
+
* Image Map Editor (imgmap) - in-browser imagemap editor
|
12437
|
+
* Copyright (C) 2006 - 2008 Adam Maschek (adam.maschek @ gmail.com)
|
12438
|
+
*
|
12439
|
+
* This program is free software; you can redistribute it and/or
|
12440
|
+
* modify it under the terms of the GNU General Public License
|
12441
|
+
* as published by the Free Software Foundation; either version 2
|
12442
|
+
* of the License, or (at your option) any later version.
|
12443
|
+
*
|
12444
|
+
* This program is distributed in the hope that it will be useful,
|
12445
|
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
12446
|
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
12447
|
+
* GNU General Public License for more details.
|
12448
|
+
*
|
12449
|
+
* You should have received a copy of the GNU General Public License
|
12450
|
+
* along with this program; if not, write to the Free Software
|
12451
|
+
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
12452
|
+
*/
|
12453
|
+
/**
|
12454
|
+
* @fileoverview
|
12455
|
+
* Online Image Map Editor - main script file.
|
12456
|
+
* This is the main script file of the Online Image Map Editor.
|
12457
|
+
*
|
12458
|
+
* @date 26-02-2007 2:24:50
|
12459
|
+
* @author Adam Maschek (adam.maschek(at)gmail.com)
|
12460
|
+
* @copyright
|
12461
|
+
* @version 2.2
|
12462
|
+
*
|
12463
|
+
*/
|
12464
|
+
/*jslint browser: true, newcap: false, white: false, onevar: false, plusplus: false, eqeqeq: false, nomen: false */
|
12465
|
+
/*global imgmapStrings:true, window:false, G_vmlCanvasManager:false */
|
12466
|
+
var QMSCKEditorImageMapLib = /** @class */ (function () {
|
12467
|
+
function QMSCKEditorImageMapLib(options) {
|
12468
|
+
/** Version string of imgmap */
|
12469
|
+
this.version = "2.2";
|
12470
|
+
/** Build date of imgmap */
|
12471
|
+
this.buildDate = "2009/08/12 22:18";
|
12472
|
+
/** Sequential build number of imgmap */
|
12473
|
+
this.buildNumber = "113";
|
12474
|
+
/** Status flag to indicate current drawing mode */
|
12475
|
+
this.is_drawing = 0;
|
12476
|
+
/** Array to hold language strings */
|
12477
|
+
this.strings = [];
|
12478
|
+
/** Helper array for some drawing operations */
|
12479
|
+
this.memory = [];
|
12480
|
+
/** Array to hold reference to all areas (canvases) */
|
12481
|
+
this.areas = [];
|
12482
|
+
/** Associative array to hold bound event handlers */
|
12483
|
+
this.eventHandlers = {};
|
12484
|
+
this.currentid = 0;
|
12485
|
+
this.draggedId = null;
|
12486
|
+
this.selectedId = null;
|
12487
|
+
this.nextShape = 'rect';
|
12488
|
+
/** Callback events that you can handle in your GUI. */
|
12489
|
+
this.event_types = [
|
12490
|
+
'onAddArea',
|
12491
|
+
'onRemoveArea',
|
12492
|
+
'onDrawArea',
|
12493
|
+
'onResizeArea',
|
12494
|
+
'onMoveArea',
|
12495
|
+
'onLoadImage',
|
12496
|
+
'onSelectArea',
|
12497
|
+
'onStatusMessage',
|
12498
|
+
'onAreaChanged'
|
12499
|
+
];
|
12500
|
+
this.isLoaded = false;
|
12501
|
+
/** holds the name of the actively edited map, use getMapName to read it */
|
12502
|
+
this.mapname = '';
|
12503
|
+
/** holds the id of the actively edited map, use getMapIdto read it */
|
12504
|
+
this.mapid = '';
|
12505
|
+
/** global scale of areas (1-normal, 2-doubled, 0.5-half, etc.) */
|
12506
|
+
this.globalscale = 1;
|
12507
|
+
/** is_drawing draw mode constant */
|
12508
|
+
this.DM_RECTANGLE_DRAW = 1;
|
12509
|
+
/** is_drawing draw mode constant */
|
12510
|
+
this.DM_RECTANGLE_MOVE = 11;
|
12511
|
+
/** is_drawing draw mode constant */
|
12512
|
+
this.DM_RECTANGLE_RESIZE_TOP = 12;
|
12513
|
+
/** is_drawing draw mode constant */
|
12514
|
+
this.DM_RECTANGLE_RESIZE_RIGHT = 13;
|
12515
|
+
/** is_drawing draw mode constant */
|
12516
|
+
this.DM_RECTANGLE_RESIZE_BOTTOM = 14;
|
12517
|
+
/** is_drawing draw mode constant */
|
12518
|
+
this.DM_RECTANGLE_RESIZE_LEFT = 15;
|
12519
|
+
/** is_drawing draw mode constant */
|
12520
|
+
this.DM_SQUARE_DRAW = 2;
|
12521
|
+
/** is_drawing draw mode constant */
|
12522
|
+
this.DM_SQUARE_MOVE = 21;
|
12523
|
+
/** is_drawing draw mode constant */
|
12524
|
+
this.DM_SQUARE_RESIZE_TOP = 22;
|
12525
|
+
/** is_drawing draw mode constant */
|
12526
|
+
this.DM_SQUARE_RESIZE_RIGHT = 23;
|
12527
|
+
/** is_drawing draw mode constant */
|
12528
|
+
this.DM_SQUARE_RESIZE_BOTTOM = 24;
|
12529
|
+
/** is_drawing draw mode constant */
|
12530
|
+
this.DM_SQUARE_RESIZE_LEFT = 25;
|
12531
|
+
/** is_drawing draw mode constant */
|
12532
|
+
this.DM_POLYGON_DRAW = 3;
|
12533
|
+
/** is_drawing draw mode constant */
|
12534
|
+
this.DM_POLYGON_LASTDRAW = 30;
|
12535
|
+
/** is_drawing draw mode constant */
|
12536
|
+
this.DM_POLYGON_MOVE = 31;
|
12537
|
+
//browser sniff
|
12538
|
+
this.isMSIE = false;
|
12539
|
+
this.isSafari = false;
|
12540
|
+
/**
|
12541
|
+
* Main setup function.
|
12542
|
+
* Can be called manually or constructor will call it.
|
12543
|
+
* @date 22-02-2007 0:15:42
|
12544
|
+
* @author Adam Maschek (adam.maschek(at)gmail.com)
|
12545
|
+
* @param config config object
|
12546
|
+
* @return True if all went ok.
|
12547
|
+
*/
|
12548
|
+
this.setup = function (options) {
|
12549
|
+
//copy non-default options parameters to this.config
|
12550
|
+
for (var i in options) {
|
12551
|
+
if (options.hasOwnProperty(i)) {
|
12552
|
+
this.config[i] = options[i];
|
12553
|
+
}
|
12554
|
+
}
|
12555
|
+
//set document event hooks
|
12556
|
+
this.addEvent(document, 'keydown', this.eventHandlers.doc_keydown = this.doc_keydown.bind(this));
|
12557
|
+
this.addEvent(document, 'keyup', this.eventHandlers.doc_keyup = this.doc_keyup.bind(this));
|
12558
|
+
this.addEvent(document, 'mousedown', this.eventHandlers.doc_mousedown = this.doc_mousedown.bind(this));
|
12559
|
+
//set imageElement element - supposedly it already exists in the DOM
|
12560
|
+
this.imageElement = options.imageElement;
|
12561
|
+
if (!this.imageElement) {
|
12562
|
+
throw 'The image element must be existed in the DOM';
|
12563
|
+
}
|
12564
|
+
if (!this.imageElement.parentElement) {
|
12565
|
+
throw 'The parent of the image element must be existed in the DOM';
|
12566
|
+
}
|
12567
|
+
this.parentImageElement = this.imageElement.parentElement;
|
12568
|
+
this.disableSelection(this.parentImageElement);
|
12569
|
+
//wipe all
|
12570
|
+
this.removeAllAreas();
|
12571
|
+
//reset scale
|
12572
|
+
this.globalscale = 1;
|
12573
|
+
//setup events
|
12574
|
+
this.addEvent(this.imageElement, "dragstart", this.eventHandlers.img_dragstart = this.img_dragstart.bind(this));
|
12575
|
+
this.addEvent(this.imageElement, 'mousedown', this.eventHandlers.img_mousedown = this.img_mousedown.bind(this));
|
12576
|
+
this.addEvent(this.imageElement, 'mouseup', this.eventHandlers.img_mouseup = this.img_mouseup.bind(this));
|
12577
|
+
this.addEvent(this.imageElement, 'mousemove', this.eventHandlers.img_mousemove = this.img_mousemove.bind(this));
|
12578
|
+
this.imageElement.style.cursor = this.config.cursor_default;
|
12579
|
+
//Load strings from a key:value object
|
12580
|
+
if (options.strings) {
|
12581
|
+
for (var key in options.strings) {
|
12582
|
+
if (options.strings.hasOwnProperty(key)) {
|
12583
|
+
this.strings[key] = options.strings[key];
|
12584
|
+
}
|
12585
|
+
}
|
12502
12586
|
}
|
12503
|
-
|
12504
|
-
|
12505
|
-
|
12506
|
-
|
12507
|
-
|
12508
|
-
|
12509
|
-
|
12510
|
-
|
12511
|
-
|
12512
|
-
|
12513
|
-
|
12514
|
-
|
12515
|
-
|
12516
|
-
|
12517
|
-
|
12518
|
-
server: 'aspx'
|
12587
|
+
//validate event hooks
|
12588
|
+
var found, j, le;
|
12589
|
+
for (i in this.config.custom_callbacks) {
|
12590
|
+
if (this.config.custom_callbacks.hasOwnProperty(i)) {
|
12591
|
+
found = false;
|
12592
|
+
for (j = 0, le = this.event_types.length; j < le; j++) {
|
12593
|
+
if (i == this.event_types[j]) {
|
12594
|
+
found = true;
|
12595
|
+
break;
|
12596
|
+
}
|
12597
|
+
}
|
12598
|
+
//TODO: remove invalid callback
|
12599
|
+
if (!found) {
|
12600
|
+
this.log("Unknown custom callback: " + i, 1);
|
12601
|
+
}
|
12519
12602
|
}
|
12520
12603
|
}
|
12604
|
+
return true;
|
12521
12605
|
};
|
12522
|
-
|
12523
|
-
|
12524
|
-
|
12525
|
-
|
12526
|
-
|
12527
|
-
|
12528
|
-
|
12529
|
-
|
12530
|
-
|
12531
|
-
|
12532
|
-
|
12533
|
-
|
12534
|
-
|
12535
|
-
|
12536
|
-
|
12537
|
-
|
12538
|
-
valid: false,
|
12539
|
-
actual: c.value
|
12606
|
+
/**
|
12607
|
+
* Attach new 'evt' event handler 'callback' to 'obj'
|
12608
|
+
* @date 24-02-2007 21:16:20
|
12609
|
+
* @param obj The object on which the handler is defined.
|
12610
|
+
* @param evt The name of the event, like mousedown.
|
12611
|
+
* @param callback The callback function (named if you want it to be removed).
|
12612
|
+
*/
|
12613
|
+
this.addEvent = function (obj, evt, callback) {
|
12614
|
+
if (obj.addEventListener) {
|
12615
|
+
//W3C style model
|
12616
|
+
obj.addEventListener(evt, callback, false);
|
12617
|
+
return true;
|
12618
|
+
}
|
12619
|
+
else {
|
12620
|
+
//Microsoft style registration model
|
12621
|
+
return obj.attachEvent("on" + evt, callback);
|
12540
12622
|
}
|
12541
12623
|
};
|
12542
|
-
|
12543
|
-
|
12544
|
-
|
12545
|
-
|
12546
|
-
|
12547
|
-
|
12548
|
-
|
12549
|
-
|
12550
|
-
|
12551
|
-
|
12552
|
-
|
12553
|
-
|
12554
|
-
|
12555
|
-
|
12556
|
-
|
12557
|
-
editor.plugins.get('FileRepository').createUploadAdapter = function (loader) {
|
12558
|
-
return new UploadAdapter(loader);
|
12559
|
-
};
|
12560
|
-
// Apped Wordcount to CKeditor
|
12561
|
-
editor.plugins.get('WordCount').on('update', function (evt, stats) {
|
12562
|
-
// Prints the current content statistics.
|
12563
|
-
var wordsBox = document.querySelector('.wordcount-content');
|
12564
|
-
wordsBox.textContent = "Words: " + stats.words + " / Characters: " + stats.characters;
|
12565
|
-
});
|
12566
|
-
};
|
12567
|
-
/**
|
12568
|
-
* Full screen - Restore down
|
12569
|
-
*/
|
12570
|
-
QMSCKEditorComponent.prototype.fullscreenEventHandling = function () {
|
12571
|
-
var ck = window.document.getElementById('qmsckeditor');
|
12572
|
-
if (ck) {
|
12573
|
-
if (!ck.classList.contains('qmsckeditor__fullscreen')) {
|
12574
|
-
this.qmsCKEditorFullscreenComponent.showFullScreen();
|
12624
|
+
/**
|
12625
|
+
* Detach 'evt' event handled by 'callback' from 'obj' object.
|
12626
|
+
* Callback must be a non anonymous function, see eventHandlers.
|
12627
|
+
* @see #eventHandlers
|
12628
|
+
* Example: myimgmap.removeEvent(myimgmap.pic, 'mousedown', myimgmap.eventHandlers.img_mousedown);
|
12629
|
+
* @date 24-11-2007 15:22:17
|
12630
|
+
* @param obj The object on which the handler is defined.
|
12631
|
+
* @param evt The name of the event, like mousedown.
|
12632
|
+
* @param callback The named callback function.
|
12633
|
+
*/
|
12634
|
+
this.removeEvent = function (obj, evt, callback) {
|
12635
|
+
if (obj.removeEventListener) {
|
12636
|
+
//W3C style model
|
12637
|
+
obj.removeEventListener(evt, callback, false);
|
12638
|
+
return true;
|
12575
12639
|
}
|
12576
12640
|
else {
|
12577
|
-
|
12641
|
+
//Microsoft style detach model
|
12642
|
+
return obj.detachEvent("on" + evt, callback);
|
12578
12643
|
}
|
12579
|
-
}
|
12644
|
+
};
|
12645
|
+
/**
|
12646
|
+
* Fires custom hook onStatusMessage, passing the status string.
|
12647
|
+
* Use this to update your GUI.
|
12648
|
+
* @author Adam Maschek (adam.maschek(at)gmail.com)
|
12649
|
+
* @date 26-07-2008 13:22:54
|
12650
|
+
* @param str The status string
|
12651
|
+
*/
|
12652
|
+
this.statusMessage = function (str) {
|
12653
|
+
this.fireEvent('onStatusMessage', str);
|
12654
|
+
};
|
12655
|
+
/**
|
12656
|
+
* Adds basic logging functionality using firebug console object if available.
|
12657
|
+
* @date 20-02-2007 17:55:18
|
12658
|
+
* @author Adam Maschek (adam.maschek(at)gmail.com)
|
12659
|
+
* @param obj The object or string you want to debug/echo.
|
12660
|
+
*/
|
12661
|
+
this.log = function (obj, level) {
|
12662
|
+
};
|
12663
|
+
/**
|
12664
|
+
* Get the map name of the current imagemap.
|
12665
|
+
* If doesnt exist, nor map id, generate a new name based on timestamp.
|
12666
|
+
* The most portable solution is to use the same value for id and name.
|
12667
|
+
* This also conforms the HTML 5 specification, that says:
|
12668
|
+
* "If the id attribute is also specified, both attributes must have the same value."
|
12669
|
+
* @link http://www.w3.org/html/wg/html5/#the-map-element
|
12670
|
+
* @author adam
|
12671
|
+
* @see #getMapId
|
12672
|
+
* @return The name of the map.
|
12673
|
+
*/
|
12674
|
+
this.getMapName = function () {
|
12675
|
+
if (!this.mapname) {
|
12676
|
+
if (!!this.mapid) {
|
12677
|
+
return this.mapid;
|
12678
|
+
}
|
12679
|
+
var now = new Date();
|
12680
|
+
this.mapname = 'imagemap' + now.getFullYear() + (now.getMonth() + 1) + now.getDate() + now.getHours() + now.getMinutes() + now.getSeconds();
|
12681
|
+
}
|
12682
|
+
return this.mapname;
|
12683
|
+
};
|
12684
|
+
/**
|
12685
|
+
* Get the map id of the current imagemap.
|
12686
|
+
* If doesnt exist, use map name.
|
12687
|
+
* @author adam
|
12688
|
+
* @see #getMapName
|
12689
|
+
* @return The id of the map.
|
12690
|
+
*/
|
12691
|
+
this.getMapId = function () {
|
12692
|
+
if (!this.mapid) {
|
12693
|
+
this.mapid = this.getMapName();
|
12694
|
+
}
|
12695
|
+
return this.mapid;
|
12696
|
+
};
|
12697
|
+
this.getMapJson = function () {
|
12698
|
+
var mapJson = {
|
12699
|
+
name: this.getMapName(),
|
12700
|
+
id: this.getMapId(),
|
12701
|
+
areas: []
|
12702
|
+
};
|
12703
|
+
for (var i = 0; i < this.areas.length; i++) {
|
12704
|
+
var area = this.areas[i];
|
12705
|
+
if (area && area.lastInput && area.shape) {
|
12706
|
+
var areaJson = {
|
12707
|
+
coords: area.lastInput,
|
12708
|
+
shape: area.shape,
|
12709
|
+
target: area.atarget,
|
12710
|
+
alt: area.aalt,
|
12711
|
+
href: area.ahref
|
12712
|
+
};
|
12713
|
+
mapJson.areas.push(areaJson);
|
12714
|
+
}
|
12715
|
+
}
|
12716
|
+
return mapJson;
|
12717
|
+
};
|
12718
|
+
/**
|
12719
|
+
* Convert wild shape names to normal ones.
|
12720
|
+
* @date 25-12-2008 19:27:06
|
12721
|
+
* @param shape The name of the shape to convert.
|
12722
|
+
* @return The normalized shape name, rect as default.
|
12723
|
+
*/
|
12724
|
+
this._normShape = function (shape) {
|
12725
|
+
if (!shape) {
|
12726
|
+
return 'rect';
|
12727
|
+
}
|
12728
|
+
shape = trim(shape).toLowerCase();
|
12729
|
+
if (shape.substring(0, 4) == 'rect') {
|
12730
|
+
return 'rect';
|
12731
|
+
}
|
12732
|
+
if (shape.substring(0, 4) == 'circ') {
|
12733
|
+
return 'circle';
|
12734
|
+
}
|
12735
|
+
if (shape.substring(0, 4) == 'poly') {
|
12736
|
+
return 'poly';
|
12737
|
+
}
|
12738
|
+
return 'rect';
|
12739
|
+
};
|
12740
|
+
/**
|
12741
|
+
* Try to normalize coordinates that came from:
|
12742
|
+
* 1. html textarea
|
12743
|
+
* 2. user input in the active area's input field
|
12744
|
+
* 3. from the html source in case of plugins or highlighter
|
12745
|
+
* Example of inputs that need to be handled:
|
12746
|
+
* 035,035 075,062
|
12747
|
+
* 150,217, 190,257, 150,297,110,257
|
12748
|
+
* @author adam
|
12749
|
+
* @param coords The coordinates in a string.
|
12750
|
+
* @param shape The shape of the object (rect, circle, poly).
|
12751
|
+
* @param flag Flags that modify the operation. (fromcircle, frompoly, fromrect, preserve)
|
12752
|
+
* @returns The normalized coordinates.
|
12753
|
+
*/
|
12754
|
+
this._normCoords = function (coords, shape, flag) {
|
12755
|
+
//function level var declarations
|
12756
|
+
var i; //generic cycle counter
|
12757
|
+
var sx; //smallest x
|
12758
|
+
var sy; //smallest y
|
12759
|
+
var gx; //greatest x
|
12760
|
+
var gy; //greatest y
|
12761
|
+
var temp, le;
|
12762
|
+
coords = trim(coords);
|
12763
|
+
if (coords === '') {
|
12764
|
+
return '';
|
12765
|
+
}
|
12766
|
+
var oldcoords = coords;
|
12767
|
+
//replace some general junk
|
12768
|
+
coords = coords.replace(/(\d)([^\d\.])+(\d)/g, "$1,$3"); // Other software might create decimal points, respect them
|
12769
|
+
coords = coords.replace(/,\D+(\d)/g, ",$1"); //cut leading junk
|
12770
|
+
coords = coords.replace(/,0+(\d)/g, ",$1"); //cut leading zeros
|
12771
|
+
coords = coords.replace(/(\d)(\D)+,/g, "$1,");
|
12772
|
+
coords = coords.replace(/^\D+(\d)/g, "$1"); //cut leading junk
|
12773
|
+
coords = coords.replace(/^0+(\d)/g, "$1"); //cut leading zeros
|
12774
|
+
coords = coords.replace(/(\d)(\D)+$/g, "$1"); //cut trailing junk
|
12775
|
+
//now fix other issues
|
12776
|
+
var parts = coords.split(',');
|
12777
|
+
if (shape == 'rect') {
|
12778
|
+
if (flag == 'fromcircle') {
|
12779
|
+
var r = parts[2];
|
12780
|
+
parts[0] = parts[0] - r;
|
12781
|
+
parts[1] = parts[1] - r;
|
12782
|
+
parts[2] = parseInt(parts[0], 10) + 2 * r;
|
12783
|
+
parts[3] = parseInt(parts[1], 10) + 2 * r;
|
12784
|
+
}
|
12785
|
+
else if (flag == 'frompoly') {
|
12786
|
+
sx = parseInt(parts[0], 10);
|
12787
|
+
gx = parseInt(parts[0], 10);
|
12788
|
+
sy = parseInt(parts[1], 10);
|
12789
|
+
gy = parseInt(parts[1], 10);
|
12790
|
+
for (i = 0, le = parts.length; i < le; i++) {
|
12791
|
+
if (i % 2 === 0 && parseInt(parts[i], 10) < sx) {
|
12792
|
+
sx = parseInt(parts[i], 10);
|
12793
|
+
}
|
12794
|
+
if (i % 2 === 1 && parseInt(parts[i], 10) < sy) {
|
12795
|
+
sy = parseInt(parts[i], 10);
|
12796
|
+
}
|
12797
|
+
if (i % 2 === 0 && parseInt(parts[i], 10) > gx) {
|
12798
|
+
gx = parseInt(parts[i], 10);
|
12799
|
+
}
|
12800
|
+
if (i % 2 === 1 && parseInt(parts[i], 10) > gy) {
|
12801
|
+
gy = parseInt(parts[i], 10);
|
12802
|
+
}
|
12803
|
+
}
|
12804
|
+
parts[0] = sx;
|
12805
|
+
parts[1] = sy;
|
12806
|
+
parts[2] = gx;
|
12807
|
+
parts[3] = gy;
|
12808
|
+
}
|
12809
|
+
if (!(parseInt(parts[1], 10) >= 0)) {
|
12810
|
+
parts[1] = parts[0];
|
12811
|
+
}
|
12812
|
+
if (!(parseInt(parts[2], 10) >= 0)) {
|
12813
|
+
parts[2] = parseInt(parts[0], 10) + 10;
|
12814
|
+
}
|
12815
|
+
if (!(parseInt(parts[3], 10) >= 0)) {
|
12816
|
+
parts[3] = parseInt(parts[1], 10) + 10;
|
12817
|
+
}
|
12818
|
+
if (parseInt(parts[0], 10) > parseInt(parts[2], 10)) {
|
12819
|
+
temp = parts[0];
|
12820
|
+
parts[0] = parts[2];
|
12821
|
+
parts[2] = temp;
|
12822
|
+
}
|
12823
|
+
if (parseInt(parts[1], 10) > parseInt(parts[3], 10)) {
|
12824
|
+
temp = parts[1];
|
12825
|
+
parts[1] = parts[3];
|
12826
|
+
parts[3] = temp;
|
12827
|
+
}
|
12828
|
+
coords = parts[0] + "," + parts[1] + "," + parts[2] + "," + parts[3];
|
12829
|
+
}
|
12830
|
+
else if (shape == 'circle') {
|
12831
|
+
if (flag == 'fromrect') {
|
12832
|
+
sx = parseInt(parts[0], 10);
|
12833
|
+
gx = parseInt(parts[2], 10);
|
12834
|
+
sy = parseInt(parts[1], 10);
|
12835
|
+
gy = parseInt(parts[3], 10);
|
12836
|
+
//use smaller side
|
12837
|
+
parts[2] = (gx - sx < gy - sy) ? gx - sx : gy - sy;
|
12838
|
+
parts[2] = Math.floor(parts[2] / 2); //radius
|
12839
|
+
parts[0] = sx + parts[2];
|
12840
|
+
parts[1] = sy + parts[2];
|
12841
|
+
}
|
12842
|
+
else if (flag == 'frompoly') {
|
12843
|
+
sx = parseInt(parts[0], 10);
|
12844
|
+
gx = parseInt(parts[0], 10);
|
12845
|
+
sy = parseInt(parts[1], 10);
|
12846
|
+
gy = parseInt(parts[1], 10);
|
12847
|
+
for (i = 0, le = parts.length; i < le; i++) {
|
12848
|
+
if (i % 2 === 0 && parseInt(parts[i], 10) < sx) {
|
12849
|
+
sx = parseInt(parts[i], 10);
|
12850
|
+
}
|
12851
|
+
if (i % 2 === 1 && parseInt(parts[i], 10) < sy) {
|
12852
|
+
sy = parseInt(parts[i], 10);
|
12853
|
+
}
|
12854
|
+
if (i % 2 === 0 && parseInt(parts[i], 10) > gx) {
|
12855
|
+
gx = parseInt(parts[i], 10);
|
12856
|
+
}
|
12857
|
+
if (i % 2 === 1 && parseInt(parts[i], 10) > gy) {
|
12858
|
+
gy = parseInt(parts[i], 10);
|
12859
|
+
}
|
12860
|
+
}
|
12861
|
+
//use smaller side
|
12862
|
+
parts[2] = (gx - sx < gy - sy) ? gx - sx : gy - sy;
|
12863
|
+
parts[2] = Math.floor(parts[2] / 2); //radius
|
12864
|
+
parts[0] = sx + parts[2];
|
12865
|
+
parts[1] = sy + parts[2];
|
12866
|
+
}
|
12867
|
+
if (!(parseInt(parts[1], 10) > 0)) {
|
12868
|
+
parts[1] = parts[0];
|
12869
|
+
}
|
12870
|
+
if (!(parseInt(parts[2], 10) > 0)) {
|
12871
|
+
parts[2] = 10;
|
12872
|
+
}
|
12873
|
+
coords = parts[0] + "," + parts[1] + "," + parts[2];
|
12874
|
+
}
|
12875
|
+
else if (shape == 'poly') {
|
12876
|
+
if (flag == 'fromrect') {
|
12877
|
+
parts[4] = parts[2];
|
12878
|
+
parts[5] = parts[3];
|
12879
|
+
parts[2] = parts[0];
|
12880
|
+
parts[6] = parts[4];
|
12881
|
+
parts[7] = parts[1];
|
12882
|
+
}
|
12883
|
+
else if (flag == 'fromcircle') {
|
12884
|
+
// @ url http://www.pixelwit.com/blog/2007/06/29/basic-circle-drawing-actionscript/
|
12885
|
+
var centerX = parseInt(parts[0], 10);
|
12886
|
+
var centerY = parseInt(parts[1], 10);
|
12887
|
+
var radius = parseInt(parts[2], 10);
|
12888
|
+
var j = 0;
|
12889
|
+
parts[j++] = centerX + radius;
|
12890
|
+
parts[j++] = centerY;
|
12891
|
+
var sides = 60; //constant = sides the fake circle will have
|
12892
|
+
for (i = 0; i <= sides; i++) {
|
12893
|
+
var pointRatio = i / sides;
|
12894
|
+
var xSteps = Math.cos(pointRatio * 2 * Math.PI);
|
12895
|
+
var ySteps = Math.sin(pointRatio * 2 * Math.PI);
|
12896
|
+
var pointX = centerX + xSteps * radius;
|
12897
|
+
var pointY = centerY + ySteps * radius;
|
12898
|
+
parts[j++] = Math.round(pointX);
|
12899
|
+
parts[j++] = Math.round(pointY);
|
12900
|
+
}
|
12901
|
+
}
|
12902
|
+
coords = parts.join(',');
|
12903
|
+
}
|
12904
|
+
if (flag == 'preserve' && oldcoords != coords) {
|
12905
|
+
//return original and throw error
|
12906
|
+
//throw "invalid coords";
|
12907
|
+
return oldcoords;
|
12908
|
+
}
|
12909
|
+
return coords;
|
12910
|
+
};
|
12911
|
+
/**
|
12912
|
+
* Sets the coordinates according to the given JSON map code or DOM object.
|
12913
|
+
* @author Adam Maschek (adam.maschek(at)gmail.com)
|
12914
|
+
* @date 2006-06-07 11:47:16
|
12915
|
+
* @param map DOM object or string of a map you want to apply.
|
12916
|
+
* @return True on success
|
12917
|
+
*/
|
12918
|
+
this.setMapJson = function (map) {
|
12919
|
+
this.fireEvent('onSetMap', map);
|
12920
|
+
//remove all areas
|
12921
|
+
this.removeAllAreas();
|
12922
|
+
this.mapname = map.name;
|
12923
|
+
this.mapid = map.id;
|
12924
|
+
var shape, coords, href, alt, title, target, id;
|
12925
|
+
for (var i = 0, le = map.areas.length; i < le; i++) {
|
12926
|
+
shape = coords = href = alt = title = target = '';
|
12927
|
+
id = this.addNewArea(); //btw id == this.currentid, just this form is a bit clearer
|
12928
|
+
shape = this._normShape(map.areas[i].shape);
|
12929
|
+
this.initArea(id, shape);
|
12930
|
+
if (map.areas[i].coords) {
|
12931
|
+
//normalize coords
|
12932
|
+
coords = this._normCoords(map.areas[i].coords, shape);
|
12933
|
+
this.areas[id].lastInput = coords;
|
12934
|
+
//for area this one will be set in recalculate
|
12935
|
+
}
|
12936
|
+
href = map.areas[i].href;
|
12937
|
+
if (href) {
|
12938
|
+
this.areas[id].ahref = href;
|
12939
|
+
}
|
12940
|
+
alt = map.areas[i].alt;
|
12941
|
+
if (alt) {
|
12942
|
+
this.areas[id].aalt = alt;
|
12943
|
+
}
|
12944
|
+
target = map.areas[i].target;
|
12945
|
+
if (target) {
|
12946
|
+
target = target.toLowerCase();
|
12947
|
+
}
|
12948
|
+
this.areas[id].atarget = target;
|
12949
|
+
this._recalculate(id, coords); //contains repaint
|
12950
|
+
this.relaxArea(id);
|
12951
|
+
this.fireEvent('onAreaChanged', this.areas[id]);
|
12952
|
+
} //end for areas
|
12953
|
+
};
|
12954
|
+
/**
|
12955
|
+
* Adds a new area. It will later become a canvas.
|
12956
|
+
* GUI should use the onAddArea callback to act accordingly.
|
12957
|
+
* @author Adam Maschek (adam.maschek(at)gmail.com)
|
12958
|
+
* @date 2006-06-06 16:49:25
|
12959
|
+
* @see #initArea
|
12960
|
+
*/
|
12961
|
+
this.addNewArea = function () {
|
12962
|
+
var lastarea = this._getLastArea();
|
12963
|
+
var id = (lastarea) ? lastarea.aid + 1 : 0;
|
12964
|
+
//insert new possibly? unknown area (will be initialized at mousedown)
|
12965
|
+
var area = this.areas[id] = document.createElement('DIV');
|
12966
|
+
area.id = this.mapname + 'area' + id;
|
12967
|
+
area.aid = id;
|
12968
|
+
area.shape = "undefined";
|
12969
|
+
this.blurArea(this.currentid);
|
12970
|
+
this.currentid = id;
|
12971
|
+
return id;
|
12972
|
+
};
|
12973
|
+
/**
|
12974
|
+
* Initialize a new area.
|
12975
|
+
* Create the canvas, initialize it.
|
12976
|
+
* Reset area parameters.
|
12977
|
+
* @param id The id of the area (already existing with undefined shape)
|
12978
|
+
* @param shape The shape the area will have (rect, circle, poly)
|
12979
|
+
*/
|
12980
|
+
this.initArea = function (id, shape) {
|
12981
|
+
var area = this.areas[id];
|
12982
|
+
if (!area) {
|
12983
|
+
return;
|
12984
|
+
} //if all was erased, return
|
12985
|
+
//remove preinited dummy div or already placed canvas
|
12986
|
+
if (area.parentNode) {
|
12987
|
+
area.parentNode.removeChild(area);
|
12988
|
+
}
|
12989
|
+
if (area.label) {
|
12990
|
+
area.label.parentNode.removeChild(area.label);
|
12991
|
+
}
|
12992
|
+
//create CANVAS node
|
12993
|
+
area = this.areas[id] = document.createElement('CANVAS');
|
12994
|
+
this.parentImageElement.appendChild(area);
|
12995
|
+
this.parentImageElement.style.position = 'relative';
|
12996
|
+
// if (typeof G_vmlCanvasManager != "undefined") {
|
12997
|
+
// //override CANVAS with VML object
|
12998
|
+
// area = this.areas[id] = G_vmlCanvasManager.initElement(area);
|
12999
|
+
// }
|
13000
|
+
area.id = this.mapname + 'area' + id;
|
13001
|
+
area.aid = id;
|
13002
|
+
area.shape = shape;
|
13003
|
+
area.ahref = '';
|
13004
|
+
area.atitle = '';
|
13005
|
+
area.aalt = '';
|
13006
|
+
area.atarget = '';
|
13007
|
+
area.style.position = 'absolute';
|
13008
|
+
area.style.top = this.imageElement.offsetTop + 'px';
|
13009
|
+
area.style.left = this.imageElement.offsetLeft + 'px';
|
13010
|
+
this._setopacity(area, this.config.CL_DRAW_BG, this.config.draw_opacity);
|
13011
|
+
//hook event handlers
|
13012
|
+
area.onmousedown = this.area_mousedown.bind(this);
|
13013
|
+
area.onmouseup = this.area_mouseup.bind(this);
|
13014
|
+
area.onmousemove = this.area_mousemove.bind(this);
|
13015
|
+
area.onmouseover = this.area_mouseover.bind(this);
|
13016
|
+
area.onmouseout = this.area_mouseout.bind(this);
|
13017
|
+
//initialize memory object
|
13018
|
+
this.memory[id] = {};
|
13019
|
+
this.memory[id].downx = 0;
|
13020
|
+
this.memory[id].downy = 0;
|
13021
|
+
this.memory[id].left = 0;
|
13022
|
+
this.memory[id].top = 0;
|
13023
|
+
this.memory[id].width = 0;
|
13024
|
+
this.memory[id].height = 0;
|
13025
|
+
this.memory[id].xpoints = [];
|
13026
|
+
this.memory[id].ypoints = [];
|
13027
|
+
//create label node
|
13028
|
+
area.label = document.createElement('DIV');
|
13029
|
+
this.parentImageElement.appendChild(area.label);
|
13030
|
+
area.label.className = this.config.label_class;
|
13031
|
+
this.assignCSS(area.label, this.config.label_style);
|
13032
|
+
area.label.style.position = 'absolute';
|
13033
|
+
this.fireEvent('onAddArea', id);
|
13034
|
+
};
|
13035
|
+
/**
|
13036
|
+
* Resets area border and opacity to a normal state after drawing.
|
13037
|
+
* @author Adam Maschek (adam.maschek(at)gmail.com)
|
13038
|
+
* @date 15-02-2007 22:07:28
|
13039
|
+
* @param id The id of the area.
|
13040
|
+
|
13041
|
+
*/
|
13042
|
+
this.relaxArea = function (id) {
|
13043
|
+
var area = this.areas[id];
|
13044
|
+
if (!area) {
|
13045
|
+
return;
|
13046
|
+
}
|
13047
|
+
if (id != this.currentid) {
|
13048
|
+
this._setBorder(area, 'NORM');
|
13049
|
+
this._setopacity(area, this.config.CL_NORM_BG, this.config.norm_opacity);
|
13050
|
+
}
|
13051
|
+
else
|
13052
|
+
this.highlightArea(id);
|
13053
|
+
};
|
13054
|
+
/**
|
13055
|
+
* Set border of a given area according to style flag.
|
13056
|
+
* Possible values of style: NORM, HIGHLIGHT, DRAW.
|
13057
|
+
* Non-rectangle shapes wont get a border if config.bounding_box is false.
|
13058
|
+
* @date 26-12-2008 22:34:41
|
13059
|
+
* @param id The id of the area to set the border on.
|
13060
|
+
* @param style Coloring style (NORM, HIGHLIGHT, DRAW), see relevant colors in config.
|
13061
|
+
* @since 2.1
|
13062
|
+
*/
|
13063
|
+
this._setBorder = function (area, style) {
|
13064
|
+
if (area.shape == 'rect' || this.config.bounding_box) {
|
13065
|
+
area.style.borderWidth = '1px';
|
13066
|
+
area.style.borderStyle = (style == 'DRAW' ? 'dotted' : 'solid');
|
13067
|
+
area.style.borderColor = this.config['CL_' + style + '_' + (area.shape == 'rect' ? 'SHAPE' : 'BOX')];
|
13068
|
+
}
|
13069
|
+
else {
|
13070
|
+
//clear border
|
13071
|
+
area.style.border = '';
|
13072
|
+
}
|
13073
|
+
};
|
13074
|
+
/**
|
13075
|
+
* Set opacity of area to the given percentage, as well as set the background color.
|
13076
|
+
* If percentage contains a dash(-), the setting of the opacity will be gradual.
|
13077
|
+
* @param area The area object.
|
13078
|
+
* @param bgcolor New background color
|
13079
|
+
* @param pct Percentage of the opacity.
|
13080
|
+
*/
|
13081
|
+
this._setopacity = function (area, bgcolor, pct) {
|
13082
|
+
if (bgcolor) {
|
13083
|
+
area.style.backgroundColor = bgcolor;
|
13084
|
+
}
|
13085
|
+
if (pct && typeof pct == 'string' && pct.match(/^\d*\-\d+$/)) {
|
13086
|
+
//gradual fade
|
13087
|
+
var parts = pct.split('-');
|
13088
|
+
if (typeof parts[0] != 'undefined') {
|
13089
|
+
//set initial opacity
|
13090
|
+
parts[0] = parseInt(parts[0], 10);
|
13091
|
+
this._setopacity(area, bgcolor, parts[0]);
|
13092
|
+
}
|
13093
|
+
if (typeof parts[1] != 'undefined') {
|
13094
|
+
parts[1] = parseInt(parts[1], 10);
|
13095
|
+
var curr = this._getopacity(area);
|
13096
|
+
var _this = this;
|
13097
|
+
var diff = Math.round(parts[1] - curr);
|
13098
|
+
if (diff > 5) {
|
13099
|
+
window.setTimeout(function () { _this._setopacity(area, null, '-' + parts[1]); }, 20);
|
13100
|
+
pct = 1 * curr + 5;
|
13101
|
+
}
|
13102
|
+
else if (diff < -3) {
|
13103
|
+
window.setTimeout(function () { _this._setopacity(area, null, '-' + parts[1]); }, 20);
|
13104
|
+
pct = 1 * curr - 3;
|
13105
|
+
}
|
13106
|
+
else {
|
13107
|
+
//final set
|
13108
|
+
pct = parts[1];
|
13109
|
+
}
|
13110
|
+
}
|
13111
|
+
}
|
13112
|
+
if (!isNaN(pct)) {
|
13113
|
+
pct = Math.round(parseInt(pct, 10));
|
13114
|
+
area.style.opacity = pct / 100;
|
13115
|
+
area.style.filter = 'alpha(opacity=' + pct + ')';
|
13116
|
+
}
|
13117
|
+
};
|
13118
|
+
/**
|
13119
|
+
* Get the currently set opacity of a given area.
|
13120
|
+
* @author adam
|
13121
|
+
* @param area The area (canvas) you want to get opacity info from.
|
13122
|
+
* @return Opacity value in a range of 0-100.
|
13123
|
+
*/
|
13124
|
+
this._getopacity = function (area) {
|
13125
|
+
if (area.style.opacity <= 1) {
|
13126
|
+
return area.style.opacity * 100;
|
13127
|
+
}
|
13128
|
+
if (area.style.filter) {
|
13129
|
+
//alpha(opacity=NaN)
|
13130
|
+
return parseInt(area.style.filter.replace(/alpha\(opacity\=([^\)]*)\)/ig, "$1"), 10);
|
13131
|
+
}
|
13132
|
+
return 100; //default opacity
|
13133
|
+
};
|
13134
|
+
/**
|
13135
|
+
* Removes the area marked by id.
|
13136
|
+
* Callback will call the GUI code to remove GUI elements.
|
13137
|
+
* @author Adam Maschek (adam.maschek(at)gmail.com)
|
13138
|
+
* @date 11-02-2007 20:40:58
|
13139
|
+
* @param id The id of the area to remove.
|
13140
|
+
* @see #removeAllAreas
|
13141
|
+
*/
|
13142
|
+
this.removeArea = function (id) {
|
13143
|
+
if (id === null || typeof id == "undefined") {
|
13144
|
+
return;
|
13145
|
+
} //exit if no id given
|
13146
|
+
try {
|
13147
|
+
//remove area and label
|
13148
|
+
//explicitly set some values to null to avoid IE circular reference memleak
|
13149
|
+
this.areas[id].label.parentNode.removeChild(this.areas[id].label);
|
13150
|
+
this.areas[id].parentNode.removeChild(this.areas[id]);
|
13151
|
+
this.areas[id].label.className = null;
|
13152
|
+
this.areas[id].label = null;
|
13153
|
+
this.areas[id].onmouseover = null;
|
13154
|
+
this.areas[id].onmouseout = null;
|
13155
|
+
this.areas[id].onmouseup = null;
|
13156
|
+
this.areas[id].onmousedown = null;
|
13157
|
+
this.areas[id].onmousemove = null;
|
13158
|
+
}
|
13159
|
+
catch (err) {
|
13160
|
+
}
|
13161
|
+
this.areas[id] = null;
|
13162
|
+
this.fireEvent('onRemoveArea', id);
|
13163
|
+
};
|
13164
|
+
/**
|
13165
|
+
* Removes all areas.
|
13166
|
+
* Will call removeArea on all areas.
|
13167
|
+
* @author Adam Maschek (adam.maschek(at)gmail.com)
|
13168
|
+
* @date 2006-06-07 11:55:34
|
13169
|
+
* @see #removeArea
|
13170
|
+
*/
|
13171
|
+
this.removeAllAreas = function () {
|
13172
|
+
for (var i = 0, le = this.areas.length; i < le; i++) {
|
13173
|
+
if (this.areas[i]) {
|
13174
|
+
this.removeArea(i);
|
13175
|
+
}
|
13176
|
+
}
|
13177
|
+
};
|
13178
|
+
/**
|
13179
|
+
* Scales all areas.
|
13180
|
+
* Will store scale parameter in globalscale property.
|
13181
|
+
* This is needed to know how to draw new areas on an already scaled canvas.
|
13182
|
+
* @author adam
|
13183
|
+
* @date 02-11-2008 14:13:14
|
13184
|
+
* @param scale Scale factor (1-original, 0.5-half, 2-double, etc.)
|
13185
|
+
*/
|
13186
|
+
this.scaleAllAreas = function (scale) {
|
13187
|
+
var rscale = scale / this.globalscale; //relative scale
|
13188
|
+
this.globalscale = scale;
|
13189
|
+
for (var i = 0, le = this.areas.length; i < le; i++) {
|
13190
|
+
if (this.areas[i] && this.areas[i].shape != 'undefined') {
|
13191
|
+
this.scaleArea(i, rscale);
|
13192
|
+
}
|
13193
|
+
}
|
13194
|
+
};
|
13195
|
+
/**
|
13196
|
+
* Scales one area.
|
13197
|
+
* @author adam
|
13198
|
+
* @date 02-11-2008 14:13:14
|
13199
|
+
* @param rscale Relative scale factor (1-keep, 0.5-half, 2-double, etc.)
|
13200
|
+
*/
|
13201
|
+
this.scaleArea = function (id, rscale) {
|
13202
|
+
var area = this.areas[id];
|
13203
|
+
//set position and new dimensions
|
13204
|
+
area.style.top = parseInt(area.style.top, 10) * rscale + 'px';
|
13205
|
+
area.style.left = parseInt(area.style.left, 10) * rscale + 'px';
|
13206
|
+
this.setAreaSize(id, area.width * rscale, area.height * rscale);
|
13207
|
+
//handle polygon coordinates scaling
|
13208
|
+
if (area.shape == 'poly') {
|
13209
|
+
for (var i = 0, le = area.xpoints.length; i < le; i++) {
|
13210
|
+
area.xpoints[i] *= rscale;
|
13211
|
+
area.ypoints[i] *= rscale;
|
13212
|
+
}
|
13213
|
+
}
|
13214
|
+
this._repaint(area, this.config.CL_NORM_SHAPE);
|
13215
|
+
this._updatecoords(id);
|
13216
|
+
};
|
13217
|
+
/**
|
13218
|
+
* Put label in the top left corner according to label config.
|
13219
|
+
* By default it will contain the number of the area (area.aid)
|
13220
|
+
* @param id The id of the area to add label to.
|
13221
|
+
*/
|
13222
|
+
this._putlabel = function (id) {
|
13223
|
+
var area = this.areas[id];
|
13224
|
+
if (!area.label) {
|
13225
|
+
return;
|
13226
|
+
} //not yet inited
|
13227
|
+
try {
|
13228
|
+
if (!this.config.label) {
|
13229
|
+
area.label.innerHTML = '';
|
13230
|
+
area.label.style.display = 'none';
|
13231
|
+
}
|
13232
|
+
else {
|
13233
|
+
area.label.style.display = '';
|
13234
|
+
var label = this.config.label;
|
13235
|
+
label = label.replace(/%n/g, String(id));
|
13236
|
+
label = label.replace(/%c/g, String(area.lastInput));
|
13237
|
+
label = label.replace(/%h/g, String(area.ahref));
|
13238
|
+
label = label.replace(/%a/g, String(area.aalt));
|
13239
|
+
label = label.replace(/%t/g, String(area.atitle));
|
13240
|
+
area.label.innerHTML = label;
|
13241
|
+
}
|
13242
|
+
//align to the top left corner
|
13243
|
+
area.label.style.top = area.style.top;
|
13244
|
+
area.label.style.left = area.style.left;
|
13245
|
+
}
|
13246
|
+
catch (err) {
|
13247
|
+
this.log("Error putting label", 1);
|
13248
|
+
}
|
13249
|
+
};
|
13250
|
+
/**
|
13251
|
+
* Set area title and alt (for IE) according to the hint configuration.
|
13252
|
+
* This will show up in the usual yellow box when you hover over with the mouse.
|
13253
|
+
* @param id The id of the area to set hint at.
|
13254
|
+
*/
|
13255
|
+
this._puthint = function (id) {
|
13256
|
+
try {
|
13257
|
+
if (!this.config.hint) {
|
13258
|
+
this.areas[id].title = '';
|
13259
|
+
this.areas[id].alt = '';
|
13260
|
+
}
|
13261
|
+
else {
|
13262
|
+
var hint = this.config.hint;
|
13263
|
+
hint = hint.replace(/%n/g, String(id));
|
13264
|
+
hint = hint.replace(/%c/g, String(this.areas[id].lastInput));
|
13265
|
+
hint = hint.replace(/%h/g, String(this.areas[id].ahref));
|
13266
|
+
hint = hint.replace(/%a/g, String(this.areas[id].aalt));
|
13267
|
+
hint = hint.replace(/%t/g, String(this.areas[id].atitle));
|
13268
|
+
this.areas[id].title = hint;
|
13269
|
+
this.areas[id].alt = hint;
|
13270
|
+
}
|
13271
|
+
}
|
13272
|
+
catch (err) {
|
13273
|
+
this.log("Error putting hint", 1);
|
13274
|
+
}
|
13275
|
+
};
|
13276
|
+
/**
|
13277
|
+
* Will call repaint on all areas.
|
13278
|
+
* Useful when you change labeling or hint config on the GUI.
|
13279
|
+
* @see #_repaint
|
13280
|
+
*/
|
13281
|
+
this._repaintAll = function () {
|
13282
|
+
for (var i = 0, le = this.areas.length; i < le; i++) {
|
13283
|
+
if (this.areas[i]) {
|
13284
|
+
this._repaint(this.areas[i], this.config.CL_NORM_SHAPE);
|
13285
|
+
}
|
13286
|
+
}
|
13287
|
+
};
|
13288
|
+
/**
|
13289
|
+
* Repaints the actual canvas content.
|
13290
|
+
* This is the only canvas drawing magic that is happening.
|
13291
|
+
* In fact rectangles will not have any canvas content, just a normal css border.
|
13292
|
+
* After repainting the canvas, it will call putlabel and puthint methods.
|
13293
|
+
* @param area The area object.
|
13294
|
+
* @param color Color of the line to draw on the canvas.
|
13295
|
+
* @param x Only used for polygons as the newest control point x.
|
13296
|
+
* @param y Only used for polygons as the newest control point y.
|
13297
|
+
*/
|
13298
|
+
this._repaint = function (area, color, x, y) {
|
13299
|
+
var ctx; //canvas context
|
13300
|
+
var width, height, left, top; //canvas properties
|
13301
|
+
var i, le; //loop counter
|
13302
|
+
if (area.shape == 'circle') {
|
13303
|
+
width = parseInt(area.style.width, 10);
|
13304
|
+
var radius = Math.floor(width / 2) - 1;
|
13305
|
+
if (radius < 0)
|
13306
|
+
radius = 0;
|
13307
|
+
//get canvas context
|
13308
|
+
ctx = area.getContext("2d");
|
13309
|
+
//clear canvas
|
13310
|
+
ctx.clearRect(0, 0, width, width);
|
13311
|
+
//draw circle
|
13312
|
+
ctx.beginPath();
|
13313
|
+
ctx.strokeStyle = color;
|
13314
|
+
ctx.arc(radius, radius, radius, 0, Math.PI * 2, 0);
|
13315
|
+
ctx.stroke();
|
13316
|
+
ctx.closePath();
|
13317
|
+
//draw center
|
13318
|
+
ctx.strokeStyle = this.config.CL_KNOB;
|
13319
|
+
ctx.strokeRect(radius, radius, 1, 1);
|
13320
|
+
//put label
|
13321
|
+
this._putlabel(area.aid);
|
13322
|
+
this._puthint(area.aid);
|
13323
|
+
}
|
13324
|
+
else if (area.shape == 'rect') {
|
13325
|
+
//put label
|
13326
|
+
this._putlabel(area.aid);
|
13327
|
+
this._puthint(area.aid);
|
13328
|
+
}
|
13329
|
+
else if (area.shape == 'poly') {
|
13330
|
+
width = parseInt(area.style.width, 10);
|
13331
|
+
height = parseInt(area.style.height, 10);
|
13332
|
+
left = parseInt(area.style.left, 10);
|
13333
|
+
top = parseInt(area.style.top, 10);
|
13334
|
+
if (area.xpoints) {
|
13335
|
+
//get canvas context
|
13336
|
+
ctx = area.getContext("2d");
|
13337
|
+
//clear canvas
|
13338
|
+
ctx.clearRect(0, 0, width, height);
|
13339
|
+
//draw polygon
|
13340
|
+
ctx.beginPath();
|
13341
|
+
ctx.strokeStyle = color;
|
13342
|
+
ctx.moveTo(area.xpoints[0] - left, area.ypoints[0] - top);
|
13343
|
+
for (i = 1, le = area.xpoints.length; i < le; i++) {
|
13344
|
+
ctx.lineTo(area.xpoints[i] - left, area.ypoints[i] - top);
|
13345
|
+
}
|
13346
|
+
if (this.is_drawing == this.DM_POLYGON_DRAW || this.is_drawing == this.DM_POLYGON_LASTDRAW) {
|
13347
|
+
//only draw to the current position if not moving
|
13348
|
+
ctx.lineTo(x - left, y - top);
|
13349
|
+
}
|
13350
|
+
ctx.lineTo(area.xpoints[0] - left, area.ypoints[0] - top);
|
13351
|
+
ctx.stroke();
|
13352
|
+
ctx.closePath();
|
13353
|
+
}
|
13354
|
+
//put label
|
13355
|
+
this._putlabel(area.aid);
|
13356
|
+
this._puthint(area.aid);
|
13357
|
+
}
|
13358
|
+
};
|
13359
|
+
/**
|
13360
|
+
* Updates Area coordinates.
|
13361
|
+
* Called when needed, eg. on mousemove, mousedown.
|
13362
|
+
* Also updates html container value (thru hook).
|
13363
|
+
* Calls callback onAreaChanged so that GUI can follow.
|
13364
|
+
* This is an important hook to your GUI.
|
13365
|
+
* Uses globalscale to scale real coordinates to area coordinates.
|
13366
|
+
* @date 2006.10.24. 22:39:27
|
13367
|
+
* @author Adam Maschek (adam.maschek(at)gmail.com)
|
13368
|
+
* @param id The id of the area.
|
13369
|
+
*/
|
13370
|
+
this._updatecoords = function (id) {
|
13371
|
+
var area = this.areas[id];
|
13372
|
+
var left = Math.round(parseInt(area.style.left, 10) / this.globalscale);
|
13373
|
+
var top = Math.round(parseInt(area.style.top, 10) / this.globalscale);
|
13374
|
+
var height = Math.round(parseInt(area.style.height, 10) / this.globalscale);
|
13375
|
+
var width = Math.round(parseInt(area.style.width, 10) / this.globalscale);
|
13376
|
+
var value = '';
|
13377
|
+
if (area.shape == 'rect') {
|
13378
|
+
value = left + ',' + top + ',' + (left + width) + ',' + (top + height);
|
13379
|
+
area.lastInput = value;
|
13380
|
+
}
|
13381
|
+
else if (area.shape == 'circle') {
|
13382
|
+
var radius = Math.floor(width / 2) - 1;
|
13383
|
+
value = (left + radius) + ',' + (top + radius) + ',' + radius;
|
13384
|
+
area.lastInput = value;
|
13385
|
+
}
|
13386
|
+
else if (area.shape == 'poly') {
|
13387
|
+
if (area.xpoints) {
|
13388
|
+
for (var i = 0, le = area.xpoints.length; i < le; i++) {
|
13389
|
+
value += Math.round(area.xpoints[i] / this.globalscale) + ',' +
|
13390
|
+
Math.round(area.ypoints[i] / this.globalscale) + ',';
|
13391
|
+
}
|
13392
|
+
value = value.substring(0, value.length - 1);
|
13393
|
+
}
|
13394
|
+
area.lastInput = value;
|
13395
|
+
}
|
13396
|
+
this.fireEvent('onAreaChanged', area);
|
13397
|
+
};
|
13398
|
+
/**
|
13399
|
+
* Updates the visual representation of the area with the given id according
|
13400
|
+
* to the new coordinates that typically come from an input on the GUI.
|
13401
|
+
* Uses globalscale to scale area coordinates to real coordinates.
|
13402
|
+
* @date 2006.10.24. 22:46:55
|
13403
|
+
* @author Adam Maschek (adam.maschek(at)gmail.com)
|
13404
|
+
* @param id The id of the area.
|
13405
|
+
* @param coords The new coords, they will be normalized.
|
13406
|
+
*/
|
13407
|
+
this._recalculate = function (id, coords) {
|
13408
|
+
var area = this.areas[id];
|
13409
|
+
try {
|
13410
|
+
if (coords) {
|
13411
|
+
coords = this._normCoords(coords, area.shape, 'preserve');
|
13412
|
+
}
|
13413
|
+
else {
|
13414
|
+
coords = area.lastInput || '';
|
13415
|
+
}
|
13416
|
+
var parts = coords.split(',');
|
13417
|
+
if (area.shape == 'rect') {
|
13418
|
+
if (parts.length != 4 ||
|
13419
|
+
parseInt(parts[0], 10) > parseInt(parts[2], 10) ||
|
13420
|
+
parseInt(parts[1], 10) > parseInt(parts[3], 10)) {
|
13421
|
+
throw "invalid coords";
|
13422
|
+
}
|
13423
|
+
area.style.left = this.globalscale * (this.imageElement.offsetLeft + parseInt(parts[0], 10)) + 'px';
|
13424
|
+
area.style.top = this.globalscale * (this.imageElement.offsetTop + parseInt(parts[1], 10)) + 'px';
|
13425
|
+
this.setAreaSize(id, this.globalscale * (parts[2] - parts[0]), this.globalscale * (parts[3] - parts[1]));
|
13426
|
+
this._repaint(area, this.config.CL_NORM_SHAPE);
|
13427
|
+
}
|
13428
|
+
else if (area.shape == 'circle') {
|
13429
|
+
if (parts.length != 3 ||
|
13430
|
+
parseInt(parts[2], 10) < 0) {
|
13431
|
+
throw "invalid coords";
|
13432
|
+
}
|
13433
|
+
var width = 2 * (parts[2]);
|
13434
|
+
this.setAreaSize(id, this.globalscale * width, this.globalscale * width);
|
13435
|
+
area.style.left = this.globalscale * (this.imageElement.offsetLeft + parseInt(parts[0], 10) - width / 2) + 'px';
|
13436
|
+
area.style.top = this.globalscale * (this.imageElement.offsetTop + parseInt(parts[1], 10) - width / 2) + 'px';
|
13437
|
+
this._repaint(area, this.config.CL_NORM_SHAPE);
|
13438
|
+
}
|
13439
|
+
else if (area.shape == 'poly') {
|
13440
|
+
if (parts.length < 2) {
|
13441
|
+
throw "invalid coords";
|
13442
|
+
}
|
13443
|
+
area.xpoints = [];
|
13444
|
+
area.ypoints = [];
|
13445
|
+
for (var i = 0, le = parts.length; i < le; i += 2) {
|
13446
|
+
area.xpoints[area.xpoints.length] = this.globalscale * (this.imageElement.offsetLeft + parseInt(parts[i], 10));
|
13447
|
+
area.ypoints[area.ypoints.length] = this.globalscale * (this.imageElement.offsetTop + parseInt(parts[i + 1], 10));
|
13448
|
+
this._polygongrow(area, this.globalscale * parts[i], this.globalscale * parts[i + 1]);
|
13449
|
+
}
|
13450
|
+
this._polygonshrink(area); //includes repaint
|
13451
|
+
}
|
13452
|
+
}
|
13453
|
+
catch (err) {
|
13454
|
+
var msg = (err.message) ? err.message : 'error calculating coordinates';
|
13455
|
+
this.log(msg, 1);
|
13456
|
+
this.statusMessage(this.strings.ERR_INVALID_COORDS);
|
13457
|
+
if (area.lastInput) {
|
13458
|
+
this.fireEvent('onAreaChanged', area);
|
13459
|
+
}
|
13460
|
+
this._repaint(area, this.config.CL_NORM_SHAPE);
|
13461
|
+
return;
|
13462
|
+
}
|
13463
|
+
//on success update lastInput
|
13464
|
+
area.lastInput = coords;
|
13465
|
+
};
|
13466
|
+
/**
|
13467
|
+
* Grow polygon area to be able to contain the given new coordinates.
|
13468
|
+
* @author adam
|
13469
|
+
* @param area The area to grow.
|
13470
|
+
* @param newx The new coordinate x.
|
13471
|
+
* @param newy The new coordinate y.
|
13472
|
+
* @see #_polygonshrink
|
13473
|
+
*/
|
13474
|
+
this._polygongrow = function (area, newx, newy) {
|
13475
|
+
var xdiff = newx - parseInt(area.style.left, 10);
|
13476
|
+
var ydiff = newy - parseInt(area.style.top, 10);
|
13477
|
+
var pad = 0; //padding on the edges
|
13478
|
+
var pad2 = 0; //twice the padding
|
13479
|
+
if (newx < parseInt(area.style.left, 10)) {
|
13480
|
+
area.style.left = (newx - pad) + 'px';
|
13481
|
+
this.setAreaSize(area.aid, parseInt(area.style.width, 10) + Math.abs(xdiff) + pad2, null);
|
13482
|
+
}
|
13483
|
+
else if (newx > parseInt(area.style.left, 10) + parseInt(area.style.width, 10)) {
|
13484
|
+
this.setAreaSize(area.aid, newx - parseInt(area.style.left, 10) + pad2, null);
|
13485
|
+
}
|
13486
|
+
if (newy < parseInt(area.style.top, 10)) {
|
13487
|
+
area.style.top = (newy - pad) + 'px';
|
13488
|
+
this.setAreaSize(area.aid, null, parseInt(area.style.height, 10) + Math.abs(ydiff) + pad2);
|
13489
|
+
}
|
13490
|
+
else if (newy > parseInt(area.style.top, 10) + parseInt(area.style.height, 10)) {
|
13491
|
+
this.setAreaSize(area.aid, null, newy - parseInt(area.style.top, 10) + pad2);
|
13492
|
+
}
|
13493
|
+
};
|
13494
|
+
/**
|
13495
|
+
* Shrink the polygon bounding area to the necessary size, by first reducing it
|
13496
|
+
* to the minimum, and then gradually growing it.
|
13497
|
+
* We need this because while we were drawing the polygon, it might have expanded
|
13498
|
+
* the canvas more than needed.
|
13499
|
+
* Will repaint the area.
|
13500
|
+
* @author adam
|
13501
|
+
* @param area The area to shrink.
|
13502
|
+
* @see #_polygongrow
|
13503
|
+
*/
|
13504
|
+
this._polygonshrink = function (area) {
|
13505
|
+
area.style.left = (area.xpoints[0]) + 'px';
|
13506
|
+
area.style.top = (area.ypoints[0]) + 'px';
|
13507
|
+
this.setAreaSize(area.aid, 0, 0);
|
13508
|
+
for (var i = 0, le = area.xpoints.length; i < le; i++) {
|
13509
|
+
this._polygongrow(area, area.xpoints[i], area.ypoints[i]);
|
13510
|
+
}
|
13511
|
+
this._repaint(area, this.config.CL_NORM_SHAPE);
|
13512
|
+
};
|
13513
|
+
/**
|
13514
|
+
* EVENT HANDLER: Handles mousemove on the image.
|
13515
|
+
* This is the main drawing routine.
|
13516
|
+
* Depending on the current shape, will draw the rect/circle/poly to the new position.
|
13517
|
+
* @param e The event object.
|
13518
|
+
*/
|
13519
|
+
this.img_mousemove = function (e) {
|
13520
|
+
//function level var declarations
|
13521
|
+
var xdiff, ydiff, diff;
|
13522
|
+
//event.x is relative to parent element, but page.x is NOT
|
13523
|
+
//pos coordinates are the same absolute coords, offset coords are relative to parent
|
13524
|
+
var windowEvent = window.event;
|
13525
|
+
var pos = this._getPos(this.imageElement), x = (this.isMSIE) ? (windowEvent.x + this.parentImageElement.scrollLeft - this.imageElement.offsetLeft) : (e.clientX - pos.x), y = (this.isMSIE) ? (windowEvent.y + this.parentImageElement.scrollTop - this.imageElement.offsetTop) : (e.clientY - pos.y);
|
13526
|
+
x = Math.round(x);
|
13527
|
+
y = Math.round(y);
|
13528
|
+
//exit if outside image
|
13529
|
+
if (x < 0 || y < 0 || x > this.imageElement.width || y > this.imageElement.height) {
|
13530
|
+
return;
|
13531
|
+
}
|
13532
|
+
//old dimensions that need to be updated in this function
|
13533
|
+
if (this.memory[this.currentid]) {
|
13534
|
+
var top = this.memory[this.currentid].top;
|
13535
|
+
var left = this.memory[this.currentid].left;
|
13536
|
+
var height = this.memory[this.currentid].height;
|
13537
|
+
var width = this.memory[this.currentid].width;
|
13538
|
+
}
|
13539
|
+
var area = this.areas[this.currentid];
|
13540
|
+
// Handle shift state for Safari
|
13541
|
+
// Safari doesn't generate keyboard events for modifiers: http://bugs.webkit.org/show_bug.cgi?id=11696
|
13542
|
+
if (this.isSafari) {
|
13543
|
+
if (e.shiftKey) {
|
13544
|
+
if (this.is_drawing == this.DM_RECTANGLE_DRAW) {
|
13545
|
+
this.is_drawing = this.DM_SQUARE_DRAW;
|
13546
|
+
this.statusMessage(this.strings.SQUARE_DRAW);
|
13547
|
+
}
|
13548
|
+
}
|
13549
|
+
else {
|
13550
|
+
if (this.is_drawing == this.DM_SQUARE_DRAW && area.shape == 'rect') {
|
13551
|
+
//not for circle!
|
13552
|
+
this.is_drawing = this.DM_RECTANGLE_DRAW;
|
13553
|
+
this.statusMessage(this.strings.RECTANGLE_DRAW);
|
13554
|
+
}
|
13555
|
+
}
|
13556
|
+
}
|
13557
|
+
if (this.is_drawing == this.DM_RECTANGLE_DRAW) {
|
13558
|
+
//rectangle mode
|
13559
|
+
this.fireEvent('onDrawArea', this.currentid);
|
13560
|
+
xdiff = x - this.memory[this.currentid].downx;
|
13561
|
+
ydiff = y - this.memory[this.currentid].downy;
|
13562
|
+
this.setAreaSize(this.currentid, Math.abs(xdiff), Math.abs(ydiff));
|
13563
|
+
if (xdiff < 0) {
|
13564
|
+
area.style.left = (x + 1) + 'px';
|
13565
|
+
}
|
13566
|
+
if (ydiff < 0) {
|
13567
|
+
area.style.top = (y + 1) + 'px';
|
13568
|
+
}
|
13569
|
+
}
|
13570
|
+
else if (this.is_drawing == this.DM_SQUARE_DRAW) {
|
13571
|
+
//square mode - align to shorter side
|
13572
|
+
this.fireEvent('onDrawArea', this.currentid);
|
13573
|
+
xdiff = x - this.memory[this.currentid].downx;
|
13574
|
+
ydiff = y - this.memory[this.currentid].downy;
|
13575
|
+
if (Math.abs(xdiff) < Math.abs(ydiff)) {
|
13576
|
+
diff = Math.abs(parseInt(xdiff, 10));
|
13577
|
+
}
|
13578
|
+
else {
|
13579
|
+
diff = Math.abs(parseInt(ydiff, 10));
|
13580
|
+
}
|
13581
|
+
this.setAreaSize(this.currentid, diff, diff);
|
13582
|
+
if (xdiff < 0) {
|
13583
|
+
area.style.left = (this.memory[this.currentid].downx + diff * -1) + 'px';
|
13584
|
+
}
|
13585
|
+
if (ydiff < 0) {
|
13586
|
+
area.style.top = (this.memory[this.currentid].downy + diff * -1 + 1) + 'px';
|
13587
|
+
}
|
13588
|
+
}
|
13589
|
+
else if (this.is_drawing == this.DM_POLYGON_DRAW) {
|
13590
|
+
//polygon mode
|
13591
|
+
this.fireEvent('onDrawArea', this.currentid);
|
13592
|
+
this._polygongrow(area, x, y);
|
13593
|
+
}
|
13594
|
+
else if (this.is_drawing == this.DM_RECTANGLE_MOVE || this.is_drawing == this.DM_SQUARE_MOVE) {
|
13595
|
+
this.fireEvent('onMoveArea', this.currentid);
|
13596
|
+
x = x - this.memory[this.currentid].rdownx;
|
13597
|
+
y = y - this.memory[this.currentid].rdowny;
|
13598
|
+
if (x + width > this.imageElement.width || y + height > this.imageElement.height) {
|
13599
|
+
return;
|
13600
|
+
}
|
13601
|
+
if (x < 0 || y < 0) {
|
13602
|
+
return;
|
13603
|
+
}
|
13604
|
+
area.style.left = x + 1 + 'px';
|
13605
|
+
area.style.top = y + 1 + 'px';
|
13606
|
+
}
|
13607
|
+
else if (this.is_drawing == this.DM_POLYGON_MOVE) {
|
13608
|
+
this.fireEvent('onMoveArea', this.currentid);
|
13609
|
+
x = x - this.memory[this.currentid].rdownx;
|
13610
|
+
y = y - this.memory[this.currentid].rdowny;
|
13611
|
+
if (x + width > this.imageElement.width || y + height > this.imageElement.height) {
|
13612
|
+
return;
|
13613
|
+
}
|
13614
|
+
if (x < 0 || y < 0) {
|
13615
|
+
return;
|
13616
|
+
}
|
13617
|
+
xdiff = x - left;
|
13618
|
+
ydiff = y - top;
|
13619
|
+
if (area.xpoints) {
|
13620
|
+
for (var i = 0, le = area.xpoints.length; i < le; i++) {
|
13621
|
+
area.xpoints[i] = this.memory[this.currentid].xpoints[i] + xdiff;
|
13622
|
+
area.ypoints[i] = this.memory[this.currentid].ypoints[i] + ydiff;
|
13623
|
+
}
|
13624
|
+
}
|
13625
|
+
area.style.left = x + 'px';
|
13626
|
+
area.style.top = y + 'px';
|
13627
|
+
}
|
13628
|
+
else if (this.is_drawing == this.DM_SQUARE_RESIZE_LEFT) {
|
13629
|
+
this.fireEvent('onResizeArea', this.currentid);
|
13630
|
+
diff = x - left;
|
13631
|
+
if ((width + (-1 * diff)) > 0) {
|
13632
|
+
//real resize left
|
13633
|
+
area.style.left = x + 1 + 'px';
|
13634
|
+
area.style.top = (top + (diff / 2)) + 'px';
|
13635
|
+
this.setAreaSize(this.currentid, parseInt(width + (-1 * diff), 10), parseInt(height + (-1 * diff), 10));
|
13636
|
+
}
|
13637
|
+
else {
|
13638
|
+
//jump to another state
|
13639
|
+
this.memory[this.currentid].width = 0;
|
13640
|
+
this.memory[this.currentid].height = 0;
|
13641
|
+
this.memory[this.currentid].left = x;
|
13642
|
+
this.memory[this.currentid].top = y;
|
13643
|
+
this.is_drawing = this.DM_SQUARE_RESIZE_RIGHT;
|
13644
|
+
}
|
13645
|
+
}
|
13646
|
+
else if (this.is_drawing == this.DM_SQUARE_RESIZE_RIGHT) {
|
13647
|
+
this.fireEvent('onResizeArea', this.currentid);
|
13648
|
+
diff = x - left - width;
|
13649
|
+
if ((width + (diff)) - 1 > 0) {
|
13650
|
+
//real resize right
|
13651
|
+
area.style.top = (top + (-1 * diff / 2)) + 'px';
|
13652
|
+
this.setAreaSize(this.currentid, (width + (diff)) - 1, (height + (diff)));
|
13653
|
+
}
|
13654
|
+
else {
|
13655
|
+
//jump to another state
|
13656
|
+
this.memory[this.currentid].width = 0;
|
13657
|
+
this.memory[this.currentid].height = 0;
|
13658
|
+
this.memory[this.currentid].left = x;
|
13659
|
+
this.memory[this.currentid].top = y;
|
13660
|
+
this.is_drawing = this.DM_SQUARE_RESIZE_LEFT;
|
13661
|
+
}
|
13662
|
+
}
|
13663
|
+
else if (this.is_drawing == this.DM_SQUARE_RESIZE_TOP) {
|
13664
|
+
this.fireEvent('onResizeArea', this.currentid);
|
13665
|
+
diff = y - top;
|
13666
|
+
if ((width + (-1 * diff)) > 0) {
|
13667
|
+
//real resize top
|
13668
|
+
area.style.top = y + 1 + 'px';
|
13669
|
+
area.style.left = (left + (diff / 2)) + 'px';
|
13670
|
+
this.setAreaSize(this.currentid, (width + (-1 * diff)), (height + (-1 * diff)));
|
13671
|
+
}
|
13672
|
+
else {
|
13673
|
+
//jump to another state
|
13674
|
+
this.memory[this.currentid].width = 0;
|
13675
|
+
this.memory[this.currentid].height = 0;
|
13676
|
+
this.memory[this.currentid].left = x;
|
13677
|
+
this.memory[this.currentid].top = y;
|
13678
|
+
this.is_drawing = this.DM_SQUARE_RESIZE_BOTTOM;
|
13679
|
+
}
|
13680
|
+
}
|
13681
|
+
else if (this.is_drawing == this.DM_SQUARE_RESIZE_BOTTOM) {
|
13682
|
+
this.fireEvent('onResizeArea', this.currentid);
|
13683
|
+
diff = y - top - height;
|
13684
|
+
if ((width + (diff)) - 1 > 0) {
|
13685
|
+
//real resize bottom
|
13686
|
+
area.style.left = (left + (-1 * diff / 2)) + 'px';
|
13687
|
+
this.setAreaSize(this.currentid, (width + (diff)) - 1, (height + (diff)) - 1);
|
13688
|
+
}
|
13689
|
+
else {
|
13690
|
+
//jump to another state
|
13691
|
+
this.memory[this.currentid].width = 0;
|
13692
|
+
this.memory[this.currentid].height = 0;
|
13693
|
+
this.memory[this.currentid].left = x;
|
13694
|
+
this.memory[this.currentid].top = y;
|
13695
|
+
this.is_drawing = this.DM_SQUARE_RESIZE_TOP;
|
13696
|
+
}
|
13697
|
+
}
|
13698
|
+
else if (this.is_drawing == this.DM_RECTANGLE_RESIZE_LEFT) {
|
13699
|
+
this.fireEvent('onResizeArea', this.currentid);
|
13700
|
+
xdiff = x - left;
|
13701
|
+
if (width + (-1 * xdiff) > 0) {
|
13702
|
+
//real resize left
|
13703
|
+
area.style.left = x + 1 + 'px';
|
13704
|
+
this.setAreaSize(this.currentid, width + (-1 * xdiff), null);
|
13705
|
+
}
|
13706
|
+
else {
|
13707
|
+
//jump to another state
|
13708
|
+
this.memory[this.currentid].width = 0;
|
13709
|
+
this.memory[this.currentid].left = x;
|
13710
|
+
this.is_drawing = this.DM_RECTANGLE_RESIZE_RIGHT;
|
13711
|
+
}
|
13712
|
+
}
|
13713
|
+
else if (this.is_drawing == this.DM_RECTANGLE_RESIZE_RIGHT) {
|
13714
|
+
this.fireEvent('onResizeArea', this.currentid);
|
13715
|
+
xdiff = x - left - width;
|
13716
|
+
if ((width + (xdiff)) - 1 > 0) {
|
13717
|
+
//real resize right
|
13718
|
+
this.setAreaSize(this.currentid, (width + (xdiff)) - 1, null);
|
13719
|
+
}
|
13720
|
+
else {
|
13721
|
+
//jump to another state
|
13722
|
+
this.memory[this.currentid].width = 0;
|
13723
|
+
this.memory[this.currentid].left = x;
|
13724
|
+
this.is_drawing = this.DM_RECTANGLE_RESIZE_LEFT;
|
13725
|
+
}
|
13726
|
+
}
|
13727
|
+
else if (this.is_drawing == this.DM_RECTANGLE_RESIZE_TOP) {
|
13728
|
+
this.fireEvent('onResizeArea', this.currentid);
|
13729
|
+
ydiff = y - top;
|
13730
|
+
if ((height + (-1 * ydiff)) > 0) {
|
13731
|
+
//real resize top
|
13732
|
+
area.style.top = y + 1 + 'px';
|
13733
|
+
this.setAreaSize(this.currentid, null, (height + (-1 * ydiff)));
|
13734
|
+
}
|
13735
|
+
else {
|
13736
|
+
//jump to another state
|
13737
|
+
this.memory[this.currentid].height = 0;
|
13738
|
+
this.memory[this.currentid].top = y;
|
13739
|
+
this.is_drawing = this.DM_RECTANGLE_RESIZE_BOTTOM;
|
13740
|
+
}
|
13741
|
+
}
|
13742
|
+
else if (this.is_drawing == this.DM_RECTANGLE_RESIZE_BOTTOM) {
|
13743
|
+
this.fireEvent('onResizeArea', this.currentid);
|
13744
|
+
ydiff = y - top - height;
|
13745
|
+
if ((height + (ydiff)) - 1 > 0) {
|
13746
|
+
//real resize bottom
|
13747
|
+
this.setAreaSize(this.currentid, null, (height + (ydiff)) - 1);
|
13748
|
+
}
|
13749
|
+
else {
|
13750
|
+
//jump to another state
|
13751
|
+
this.memory[this.currentid].height = 0;
|
13752
|
+
this.memory[this.currentid].top = y;
|
13753
|
+
this.is_drawing = this.DM_RECTANGLE_RESIZE_TOP;
|
13754
|
+
}
|
13755
|
+
}
|
13756
|
+
//repaint canvas elements
|
13757
|
+
if (this.is_drawing) {
|
13758
|
+
this._repaint(area, this.config.CL_DRAW_SHAPE, x, y);
|
13759
|
+
this._updatecoords(this.currentid);
|
13760
|
+
}
|
13761
|
+
};
|
13762
|
+
/**
|
13763
|
+
* EVENT HANDLER: Handles mouseup on the image.
|
13764
|
+
* Handles dragging and resizing.
|
13765
|
+
* @param e The event object.
|
13766
|
+
*/
|
13767
|
+
this.img_mouseup = function (e) {
|
13768
|
+
var windowEvent = window.event;
|
13769
|
+
var pos = this._getPos(this.imageElement), x = (this.isMSIE) ? (windowEvent.x + this.parentImageElement.scrollLeft - this.imageElement.offsetLeft) : (e.clientX - pos.x), y = (this.isMSIE) ? (windowEvent.y + this.parentImageElement.scrollTop - this.imageElement.offsetTop) : (e.clientY - pos.y);
|
13770
|
+
x = Math.round(x);
|
13771
|
+
y = Math.round(y);
|
13772
|
+
//for everything that is move or resize
|
13773
|
+
if (this.is_drawing != this.DM_RECTANGLE_DRAW &&
|
13774
|
+
this.is_drawing != this.DM_SQUARE_DRAW &&
|
13775
|
+
this.is_drawing != this.DM_POLYGON_DRAW &&
|
13776
|
+
this.is_drawing != this.DM_POLYGON_LASTDRAW) {
|
13777
|
+
//end dragging
|
13778
|
+
this.draggedId = null;
|
13779
|
+
//finish state
|
13780
|
+
this.is_drawing = 0;
|
13781
|
+
this.statusMessage(this.strings.READY);
|
13782
|
+
this.relaxArea(this.currentid);
|
13783
|
+
if (this.areas[this.currentid] == this._getLastArea()) {
|
13784
|
+
return;
|
13785
|
+
}
|
13786
|
+
this.memory[this.currentid].downx = x;
|
13787
|
+
this.memory[this.currentid].downy = y;
|
13788
|
+
}
|
13789
|
+
};
|
13790
|
+
this.img_dragstart = function (e) {
|
13791
|
+
e.preventDefault();
|
13792
|
+
};
|
13793
|
+
/**
|
13794
|
+
* EVENT HANDLER: Handles mousedown on the image.
|
13795
|
+
* Handles beggining or end of draw, or polygon point set.
|
13796
|
+
* @param e The event object.
|
13797
|
+
*/
|
13798
|
+
this.img_mousedown = function (e) {
|
13799
|
+
if (!e)
|
13800
|
+
e = window.event;
|
13801
|
+
var pos = this._getPos(this.imageElement), x = Math.round(e.clientX - pos.x), y = Math.round(e.clientY - pos.y);
|
13802
|
+
// Handle the Shift state
|
13803
|
+
if (e.shiftKey) {
|
13804
|
+
if (this.is_drawing == this.DM_POLYGON_DRAW) {
|
13805
|
+
this.is_drawing = this.DM_POLYGON_LASTDRAW;
|
13806
|
+
}
|
13807
|
+
}
|
13808
|
+
var area = this.areas[this.currentid];
|
13809
|
+
if (this.is_drawing == this.DM_POLYGON_DRAW) {
|
13810
|
+
//its not finish state yet
|
13811
|
+
area.xpoints[area.xpoints.length] = x;
|
13812
|
+
area.ypoints[area.ypoints.length] = y;
|
13813
|
+
this.memory[this.currentid].downx = x;
|
13814
|
+
this.memory[this.currentid].downy = y;
|
13815
|
+
return;
|
13816
|
+
}
|
13817
|
+
else if (this.is_drawing && this.is_drawing != this.DM_POLYGON_DRAW) {
|
13818
|
+
//finish any other state
|
13819
|
+
if (this.is_drawing == this.DM_POLYGON_LASTDRAW) {
|
13820
|
+
//add last controlpoint and update coords
|
13821
|
+
area.xpoints[area.xpoints.length] = x;
|
13822
|
+
area.ypoints[area.ypoints.length] = y;
|
13823
|
+
this._updatecoords(this.currentid);
|
13824
|
+
this.is_drawing = 0;
|
13825
|
+
this._polygonshrink(area);
|
13826
|
+
}
|
13827
|
+
this.is_drawing = 0;
|
13828
|
+
this.statusMessage(this.strings.READY);
|
13829
|
+
this.relaxArea(this.currentid);
|
13830
|
+
if (this.areas[this.currentid] == this._getLastArea()) {
|
13831
|
+
return;
|
13832
|
+
}
|
13833
|
+
return;
|
13834
|
+
}
|
13835
|
+
if (!this.nextShape) {
|
13836
|
+
return;
|
13837
|
+
}
|
13838
|
+
this.addNewArea();
|
13839
|
+
this.initArea(this.currentid, this.nextShape);
|
13840
|
+
if (this.areas[this.currentid].shape == 'poly') {
|
13841
|
+
this.is_drawing = this.DM_POLYGON_DRAW;
|
13842
|
+
this.statusMessage(this.strings.POLYGON_DRAW);
|
13843
|
+
this.areas[this.currentid].style.left = x + 'px';
|
13844
|
+
this.areas[this.currentid].style.top = y + 'px';
|
13845
|
+
this.areas[this.currentid].style.width = 0;
|
13846
|
+
this.areas[this.currentid].style.height = 0;
|
13847
|
+
this.areas[this.currentid].xpoints = [];
|
13848
|
+
this.areas[this.currentid].ypoints = [];
|
13849
|
+
this.areas[this.currentid].xpoints[0] = x;
|
13850
|
+
this.areas[this.currentid].ypoints[0] = y;
|
13851
|
+
}
|
13852
|
+
else if (this.areas[this.currentid].shape == 'rect') {
|
13853
|
+
this.is_drawing = this.DM_RECTANGLE_DRAW;
|
13854
|
+
this.statusMessage(this.strings.RECTANGLE_DRAW);
|
13855
|
+
this.areas[this.currentid].style.left = x + 'px';
|
13856
|
+
this.areas[this.currentid].style.top = y + 'px';
|
13857
|
+
this.areas[this.currentid].style.width = 0;
|
13858
|
+
this.areas[this.currentid].style.height = 0;
|
13859
|
+
}
|
13860
|
+
else if (this.areas[this.currentid].shape == 'circle') {
|
13861
|
+
this.is_drawing = this.DM_SQUARE_DRAW;
|
13862
|
+
this.statusMessage(this.strings.CIRCLE_DRAW);
|
13863
|
+
this.areas[this.currentid].style.left = x + 'px';
|
13864
|
+
this.areas[this.currentid].style.top = y + 'px';
|
13865
|
+
this.areas[this.currentid].style.width = 0;
|
13866
|
+
this.areas[this.currentid].style.height = 0;
|
13867
|
+
}
|
13868
|
+
this._setBorder(this.areas[this.currentid], 'DRAW');
|
13869
|
+
this.memory[this.currentid].downx = x;
|
13870
|
+
this.memory[this.currentid].downy = y;
|
13871
|
+
};
|
13872
|
+
/**
|
13873
|
+
* Highlights a given area.
|
13874
|
+
* Sets opacity and repaints.
|
13875
|
+
* @date 2007.12.28. 18:23:00
|
13876
|
+
* @param id The id of the area to blur.
|
13877
|
+
|
13878
|
+
*/
|
13879
|
+
this.highlightArea = function (id) {
|
13880
|
+
if (this.is_drawing) {
|
13881
|
+
return;
|
13882
|
+
} //exit if in drawing state
|
13883
|
+
var area = this.areas[id];
|
13884
|
+
if (area && area.shape != 'undefined') {
|
13885
|
+
//area exists - highlight it
|
13886
|
+
this._setBorder(area, 'HIGHLIGHT');
|
13887
|
+
this._setopacity(area, this.config.CL_HIGHLIGHT_BG, '-' + this.config.highlight_opacity);
|
13888
|
+
this._repaint(area, this.config.CL_HIGHLIGHT_SHAPE);
|
13889
|
+
}
|
13890
|
+
};
|
13891
|
+
/**
|
13892
|
+
* Blurs a given area.
|
13893
|
+
* Sets opacity and repaints.
|
13894
|
+
* @date 2007.12.28. 18:23:26
|
13895
|
+
* @param id The id of the area to blur.
|
13896
|
+
|
13897
|
+
*/
|
13898
|
+
this.blurArea = function (id) {
|
13899
|
+
if (this.is_drawing) {
|
13900
|
+
return;
|
13901
|
+
} //exit if in drawing state
|
13902
|
+
var area = this.areas[id];
|
13903
|
+
if (area && area.shape != 'undefined') {
|
13904
|
+
//area exists - fade it back
|
13905
|
+
this._setBorder(area, 'NORM');
|
13906
|
+
this._setopacity(area, this.config.CL_NORM_BG, '-' + this.config.norm_opacity);
|
13907
|
+
this._repaint(area, this.config.CL_NORM_SHAPE);
|
13908
|
+
}
|
13909
|
+
};
|
13910
|
+
/**
|
13911
|
+
* EVENT HANDLER: Handles event of mousemove on imgmap areas.
|
13912
|
+
* - changes cursor depending where we are inside the area (buggy in opera)
|
13913
|
+
* - handles area resize
|
13914
|
+
* - handles area move
|
13915
|
+
* @url http://evolt.org/article/Mission_Impossible_mouse_position/17/23335/index.html
|
13916
|
+
* @url http://my.opera.com/community/forums/topic.dml?id=239498&t=1217158015&page=1
|
13917
|
+
* @author adam
|
13918
|
+
* @param e The event object.
|
13919
|
+
*/
|
13920
|
+
this.area_mousemove = function (e) {
|
13921
|
+
if (!this.is_drawing) {
|
13922
|
+
if (!e)
|
13923
|
+
e = window.event;
|
13924
|
+
var obj = (this.isMSIE) ? window.event.srcElement : e.currentTarget;
|
13925
|
+
if (obj.tagName == 'DIV') {
|
13926
|
+
//do this because of label
|
13927
|
+
obj = obj.parentNode;
|
13928
|
+
}
|
13929
|
+
if (obj.tagName == 'image' || obj.tagName == 'group' ||
|
13930
|
+
obj.tagName == 'shape' || obj.tagName == 'stroke') {
|
13931
|
+
//do this because of excanvas
|
13932
|
+
obj = obj.parentNode.parentNode;
|
13933
|
+
}
|
13934
|
+
var target = e.target || e.srcElement, rect = target && target.getBoundingClientRect();
|
13935
|
+
var windowEvent = window.event;
|
13936
|
+
var xdiff = rect ? e.clientX - rect.left : windowEvent.offsetX;
|
13937
|
+
var ydiff = rect ? e.clientY - rect.top : windowEvent.offsetY;
|
13938
|
+
// Alfonso
|
13939
|
+
if (this.isSafari) {
|
13940
|
+
xdiff -= window.scrollX;
|
13941
|
+
ydiff -= window.scrollY;
|
13942
|
+
}
|
13943
|
+
var resizable = (obj.shape == 'rect' || obj.shape == 'circle');
|
13944
|
+
if (resizable && xdiff < 6 && ydiff > 6) {
|
13945
|
+
//move left
|
13946
|
+
obj.style.cursor = 'w-resize';
|
13947
|
+
}
|
13948
|
+
else if (resizable && xdiff > parseInt(obj.style.width, 10) - 6 && ydiff > 6) {
|
13949
|
+
//move right
|
13950
|
+
obj.style.cursor = 'e-resize';
|
13951
|
+
}
|
13952
|
+
else if (resizable && xdiff > 6 && ydiff < 6) {
|
13953
|
+
//move top
|
13954
|
+
obj.style.cursor = 'n-resize';
|
13955
|
+
}
|
13956
|
+
else if (resizable && ydiff > parseInt(obj.style.height, 10) - 6 && xdiff > 6) {
|
13957
|
+
//move bottom
|
13958
|
+
obj.style.cursor = 's-resize';
|
13959
|
+
}
|
13960
|
+
else {
|
13961
|
+
//move all
|
13962
|
+
obj.style.cursor = 'move';
|
13963
|
+
}
|
13964
|
+
if (obj.aid != this.draggedId) {
|
13965
|
+
//not dragged or different
|
13966
|
+
if (obj.style.cursor == 'move') {
|
13967
|
+
obj.style.cursor = 'default';
|
13968
|
+
}
|
13969
|
+
return;
|
13970
|
+
}
|
13971
|
+
var area = this.areas[this.currentid];
|
13972
|
+
//moved here from mousedown
|
13973
|
+
if (xdiff < 6 && ydiff > 6) {
|
13974
|
+
//move left
|
13975
|
+
if (area.shape == 'circle') {
|
13976
|
+
this.is_drawing = this.DM_SQUARE_RESIZE_LEFT;
|
13977
|
+
this.statusMessage(this.strings.SQUARE_RESIZE_LEFT);
|
13978
|
+
}
|
13979
|
+
else if (area.shape == 'rect') {
|
13980
|
+
this.is_drawing = this.DM_RECTANGLE_RESIZE_LEFT;
|
13981
|
+
this.statusMessage(this.strings.RECTANGLE_RESIZE_LEFT);
|
13982
|
+
}
|
13983
|
+
}
|
13984
|
+
else if (xdiff > parseInt(area.style.width, 10) - 6 && ydiff > 6) {
|
13985
|
+
//move right
|
13986
|
+
if (area.shape == 'circle') {
|
13987
|
+
this.is_drawing = this.DM_SQUARE_RESIZE_RIGHT;
|
13988
|
+
this.statusMessage(this.strings.SQUARE_RESIZE_RIGHT);
|
13989
|
+
}
|
13990
|
+
else if (area.shape == 'rect') {
|
13991
|
+
this.is_drawing = this.DM_RECTANGLE_RESIZE_RIGHT;
|
13992
|
+
this.statusMessage(this.strings.RECTANGLE_RESIZE_RIGHT);
|
13993
|
+
}
|
13994
|
+
}
|
13995
|
+
else if (xdiff > 6 && ydiff < 6) {
|
13996
|
+
//move top
|
13997
|
+
if (area.shape == 'circle') {
|
13998
|
+
this.is_drawing = this.DM_SQUARE_RESIZE_TOP;
|
13999
|
+
this.statusMessage(this.strings.SQUARE_RESIZE_TOP);
|
14000
|
+
}
|
14001
|
+
else if (area.shape == 'rect') {
|
14002
|
+
this.is_drawing = this.DM_RECTANGLE_RESIZE_TOP;
|
14003
|
+
this.statusMessage(this.strings.RECTANGLE_RESIZE_TOP);
|
14004
|
+
}
|
14005
|
+
}
|
14006
|
+
else if (ydiff > parseInt(area.style.height, 10) - 6 && xdiff > 6) {
|
14007
|
+
//move bottom
|
14008
|
+
if (area.shape == 'circle') {
|
14009
|
+
this.is_drawing = this.DM_SQUARE_RESIZE_BOTTOM;
|
14010
|
+
this.statusMessage(this.strings.SQUARE_RESIZE_BOTTOM);
|
14011
|
+
}
|
14012
|
+
else if (area.shape == 'rect') {
|
14013
|
+
this.is_drawing = this.DM_RECTANGLE_RESIZE_BOTTOM;
|
14014
|
+
this.statusMessage(this.strings.RECTANGLE_RESIZE_BOTTOM);
|
14015
|
+
}
|
14016
|
+
}
|
14017
|
+
else /*if (xdiff < 10 && ydiff < 10 ) */ {
|
14018
|
+
//move all
|
14019
|
+
if (area.shape == 'circle') {
|
14020
|
+
this.is_drawing = this.DM_SQUARE_MOVE;
|
14021
|
+
this.statusMessage(this.strings.SQUARE_MOVE);
|
14022
|
+
this.memory[this.currentid].rdownx = xdiff;
|
14023
|
+
this.memory[this.currentid].rdowny = ydiff;
|
14024
|
+
}
|
14025
|
+
else if (area.shape == 'rect') {
|
14026
|
+
this.is_drawing = this.DM_RECTANGLE_MOVE;
|
14027
|
+
this.statusMessage(this.strings.RECTANGLE_MOVE);
|
14028
|
+
this.memory[this.currentid].rdownx = xdiff;
|
14029
|
+
this.memory[this.currentid].rdowny = ydiff;
|
14030
|
+
}
|
14031
|
+
else if (area.shape == 'poly') {
|
14032
|
+
if (area.xpoints) {
|
14033
|
+
for (var i = 0, le = area.xpoints.length; i < le; i++) {
|
14034
|
+
this.memory[this.currentid].xpoints[i] = area.xpoints[i];
|
14035
|
+
this.memory[this.currentid].ypoints[i] = area.ypoints[i];
|
14036
|
+
}
|
14037
|
+
}
|
14038
|
+
if (area.shape == 'poly') {
|
14039
|
+
this.is_drawing = this.DM_POLYGON_MOVE;
|
14040
|
+
this.statusMessage(this.strings.POLYGON_MOVE);
|
14041
|
+
}
|
14042
|
+
this.memory[this.currentid].rdownx = xdiff;
|
14043
|
+
this.memory[this.currentid].rdowny = ydiff;
|
14044
|
+
}
|
14045
|
+
}
|
14046
|
+
//common memory settings (preparing to move or resize)
|
14047
|
+
this.memory[this.currentid].width = parseInt(area.style.width, 10);
|
14048
|
+
this.memory[this.currentid].height = parseInt(area.style.height, 10);
|
14049
|
+
this.memory[this.currentid].top = parseInt(area.style.top, 10);
|
14050
|
+
this.memory[this.currentid].left = parseInt(area.style.left, 10);
|
14051
|
+
this._setBorder(area, 'DRAW');
|
14052
|
+
this._setopacity(area, this.config.CL_DRAW_BG, this.config.draw_opacity);
|
14053
|
+
}
|
14054
|
+
else {
|
14055
|
+
//if drawing and not ie, have to propagate to image event
|
14056
|
+
this.img_mousemove(e);
|
14057
|
+
}
|
14058
|
+
};
|
14059
|
+
/**
|
14060
|
+
* EVENT HANDLER: Handles event of mouseup on imgmap areas.
|
14061
|
+
* Basically clears draggedId.
|
14062
|
+
* @author adam
|
14063
|
+
* @param e The event object
|
14064
|
+
*/
|
14065
|
+
this.area_mouseup = function (e) {
|
14066
|
+
if (!this.is_drawing) {
|
14067
|
+
var obj = (this.isMSIE) ? window.event.srcElement : e.currentTarget;
|
14068
|
+
if (obj.tagName == 'DIV') {
|
14069
|
+
//do this because of label
|
14070
|
+
obj = obj.parentNode;
|
14071
|
+
}
|
14072
|
+
if (obj.tagName == 'image' || obj.tagName == 'group' ||
|
14073
|
+
obj.tagName == 'shape' || obj.tagName == 'stroke') {
|
14074
|
+
//do this because of excanvas
|
14075
|
+
obj = obj.parentNode.parentNode;
|
14076
|
+
}
|
14077
|
+
if (this.areas[this.currentid] != obj) {
|
14078
|
+
//trying to draw on a different canvas,switch to this one
|
14079
|
+
if (typeof obj.aid == 'undefined') {
|
14080
|
+
this.log('Cannot identify target area', 1);
|
14081
|
+
return;
|
14082
|
+
}
|
14083
|
+
}
|
14084
|
+
this.draggedId = null;
|
14085
|
+
}
|
14086
|
+
else {
|
14087
|
+
//if drawing and not ie, have to propagate to image event
|
14088
|
+
this.img_mouseup(e);
|
14089
|
+
}
|
14090
|
+
};
|
14091
|
+
/**
|
14092
|
+
* EVENT HANDLER: Handles event of mouseover on imgmap areas.
|
14093
|
+
* Calls gradual highlight on the given area.
|
14094
|
+
* @author adam
|
14095
|
+
* @param e The event object
|
14096
|
+
*/
|
14097
|
+
this.area_mouseover = function (e) {
|
14098
|
+
if (!this.is_drawing) {
|
14099
|
+
//identify source object
|
14100
|
+
var obj = (this.isMSIE) ? window.event.srcElement : e.currentTarget;
|
14101
|
+
if (obj.tagName == 'DIV') {
|
14102
|
+
//do this because of label
|
14103
|
+
obj = obj.parentNode;
|
14104
|
+
}
|
14105
|
+
if (obj.tagName == 'image' || obj.tagName == 'group' ||
|
14106
|
+
obj.tagName == 'shape' || obj.tagName == 'stroke') {
|
14107
|
+
//do this because of excanvas
|
14108
|
+
obj = obj.parentNode.parentNode;
|
14109
|
+
}
|
14110
|
+
this.highlightArea(obj.aid);
|
14111
|
+
}
|
14112
|
+
};
|
14113
|
+
/**
|
14114
|
+
* EVENT HANDLER: Handles event of mouseout on imgmap areas.
|
14115
|
+
* Calls gradient blur on the given area.
|
14116
|
+
* @author adam
|
14117
|
+
* @param e The event object
|
14118
|
+
*/
|
14119
|
+
this.area_mouseout = function (e) {
|
14120
|
+
if (!this.is_drawing) {
|
14121
|
+
if (!e)
|
14122
|
+
e = window.event;
|
14123
|
+
if (this.isMSIE) {
|
14124
|
+
// When moving to a child, ignore this mouseout event
|
14125
|
+
if (e.toElement && e.srcElement == e.toElement.parentNode)
|
14126
|
+
return;
|
14127
|
+
}
|
14128
|
+
//identify source object
|
14129
|
+
var obj = (this.isMSIE) ? e.srcElement : e.currentTarget;
|
14130
|
+
var tagName = obj.tagName.toLowerCase();
|
14131
|
+
if (tagName == 'div') {
|
14132
|
+
//do this because of label
|
14133
|
+
obj = obj.parentNode;
|
14134
|
+
}
|
14135
|
+
if (tagName == 'image' || tagName == 'group' ||
|
14136
|
+
tagName == 'shape' || tagName == 'stroke') {
|
14137
|
+
//do this because of excanvas
|
14138
|
+
obj = obj.parentNode.parentNode;
|
14139
|
+
}
|
14140
|
+
// Only blur the area if it isn't the current one
|
14141
|
+
if (this.currentid != obj.aid)
|
14142
|
+
this.blurArea(obj.aid);
|
14143
|
+
}
|
14144
|
+
};
|
14145
|
+
/**
|
14146
|
+
* EVENT HANDLER: Handles event of mousedown on imgmap areas.
|
14147
|
+
* Sets the variables draggedid, selectedid and currentid to the given area.
|
14148
|
+
* @author adam
|
14149
|
+
* @param e The event object
|
14150
|
+
*/
|
14151
|
+
this.area_mousedown = function (e) {
|
14152
|
+
if (!this.is_drawing) {
|
14153
|
+
var obj = (this.isMSIE) ? window.event.srcElement : e.currentTarget;
|
14154
|
+
if (obj.tagName == 'DIV') {
|
14155
|
+
//do this because of label
|
14156
|
+
obj = obj.parentNode;
|
14157
|
+
}
|
14158
|
+
if (obj.tagName == 'image' || obj.tagName == 'group' ||
|
14159
|
+
obj.tagName == 'shape' || obj.tagName == 'stroke') {
|
14160
|
+
//do this because of excanvas
|
14161
|
+
obj = obj.parentNode.parentNode;
|
14162
|
+
}
|
14163
|
+
if (this.areas[this.currentid] != obj) {
|
14164
|
+
//trying to draw on a different canvas, switch to this one
|
14165
|
+
if (typeof obj.aid == 'undefined') {
|
14166
|
+
this.log('Cannot identify target area', 1);
|
14167
|
+
return;
|
14168
|
+
}
|
14169
|
+
this.blurArea(this.currentid);
|
14170
|
+
this.currentid = obj.aid;
|
14171
|
+
this.highlightArea(obj.aid);
|
14172
|
+
}
|
14173
|
+
this.draggedId = this.currentid;
|
14174
|
+
this.selectedId = this.currentid;
|
14175
|
+
this.fireEvent('onSelectArea', this.areas[this.currentid]);
|
14176
|
+
//stop event propagation to document level
|
14177
|
+
if (this.isMSIE) {
|
14178
|
+
window.event.cancelBubble = true;
|
14179
|
+
}
|
14180
|
+
else {
|
14181
|
+
e.stopPropagation();
|
14182
|
+
}
|
14183
|
+
}
|
14184
|
+
else {
|
14185
|
+
//if drawing and not ie, have to propagate to image event
|
14186
|
+
this.img_mousedown(e);
|
14187
|
+
}
|
14188
|
+
};
|
14189
|
+
/**
|
14190
|
+
* EVENT HANDLER: Handles event 'keydown' on document.
|
14191
|
+
* Handles SHIFT hold while drawing.
|
14192
|
+
* Note: Safari doesn't generate keyboard events for modifiers:
|
14193
|
+
* @url http://bugs.webkit.org/show_bug.cgi?id=11696
|
14194
|
+
* @author adam
|
14195
|
+
* @param e The event object
|
14196
|
+
*/
|
14197
|
+
this.doc_keydown = function (e) {
|
14198
|
+
if (e.keyCode == 46 || e.key == "Delete") {
|
14199
|
+
//delete key pressed
|
14200
|
+
if (this.selectedId !== null && !this.is_drawing) {
|
14201
|
+
this.removeArea(this.selectedId);
|
14202
|
+
}
|
14203
|
+
}
|
14204
|
+
else if (e.keyCode == 16 || e.key == "Shift") {
|
14205
|
+
//shift key pressed
|
14206
|
+
if (this.is_drawing == this.DM_RECTANGLE_DRAW) {
|
14207
|
+
this.is_drawing = this.DM_SQUARE_DRAW;
|
14208
|
+
this.statusMessage(this.strings.SQUARE_DRAW);
|
14209
|
+
}
|
14210
|
+
}
|
14211
|
+
};
|
14212
|
+
/**
|
14213
|
+
* EVENT HANDLER: Handles event 'keyup' on document.
|
14214
|
+
* Handles SHIFT release while drawing.
|
14215
|
+
* @author adam
|
14216
|
+
* @param e The event object
|
14217
|
+
*/
|
14218
|
+
this.doc_keyup = function (e) {
|
14219
|
+
if (e.keyCode == 16 || e.key == "Shift") {
|
14220
|
+
//shift key released
|
14221
|
+
if (this.is_drawing == this.DM_SQUARE_DRAW && this.areas[this.currentid].shape == 'rect') {
|
14222
|
+
//not for circle!
|
14223
|
+
this.is_drawing = this.DM_RECTANGLE_DRAW;
|
14224
|
+
this.statusMessage(this.strings.RECTANGLE_DRAW);
|
14225
|
+
}
|
14226
|
+
}
|
14227
|
+
};
|
14228
|
+
/**
|
14229
|
+
* EVENT HANDLER: Handles event 'mousedown' on document.
|
14230
|
+
* @author adam
|
14231
|
+
* @param e The event object
|
14232
|
+
*/
|
14233
|
+
this.doc_mousedown = function (e) {
|
14234
|
+
if (!this.is_drawing) {
|
14235
|
+
this.selectedId = null;
|
14236
|
+
}
|
14237
|
+
};
|
14238
|
+
/**
|
14239
|
+
* Get the real position of the element.
|
14240
|
+
* Deal with browser differences when trying to get the position of an area.
|
14241
|
+
* @param element The element you want the position of.
|
14242
|
+
* @return An object with x and y members.
|
14243
|
+
*/
|
14244
|
+
this._getPos = function (element) {
|
14245
|
+
var bounding = element.getBoundingClientRect();
|
14246
|
+
return { x: bounding.left, y: bounding.top };
|
14247
|
+
};
|
14248
|
+
/**
|
14249
|
+
* Gets the last (visible and editable) area.
|
14250
|
+
* @author Adam Maschek (adam.maschek(at)gmail.com)
|
14251
|
+
* @date 2006-06-15 16:34:51
|
14252
|
+
* @returns The last area object or null.
|
14253
|
+
*/
|
14254
|
+
this._getLastArea = function () {
|
14255
|
+
for (var i = this.areas.length - 1; i >= 0; i--) {
|
14256
|
+
if (this.areas[i]) {
|
14257
|
+
return this.areas[i];
|
14258
|
+
}
|
14259
|
+
}
|
14260
|
+
return null;
|
14261
|
+
};
|
14262
|
+
/**
|
14263
|
+
* Parses cssText to single style declarations.
|
14264
|
+
* @author adam
|
14265
|
+
* @date 25-09-2007 18:19:51
|
14266
|
+
* @param obj The DOM object to apply styles on.
|
14267
|
+
* @param cssText The css declarations to apply.
|
14268
|
+
*/
|
14269
|
+
this.assignCSS = function (obj, cssText) {
|
14270
|
+
var parts = cssText.split(';');
|
14271
|
+
for (var i = 0; i < parts.length; i++) {
|
14272
|
+
var p = parts[i].split(':');
|
14273
|
+
//we need to camelcase by - signs
|
14274
|
+
var pp = trim(p[0]).split('-');
|
14275
|
+
var prop = pp[0];
|
14276
|
+
for (var j = 1; j < pp.length; j++) {
|
14277
|
+
//replace first letters to uppercase
|
14278
|
+
prop += pp[j].replace(/^\w/, pp[j].substring(0, 1).toUpperCase());
|
14279
|
+
}
|
14280
|
+
obj.style[trim(prop)] = trim(p[1]);
|
14281
|
+
}
|
14282
|
+
};
|
14283
|
+
/**
|
14284
|
+
* To fire callback hooks on custom events, passing them the object of the event.
|
14285
|
+
* @author adam
|
14286
|
+
* @date 13-10-2007 15:24:49
|
14287
|
+
* @param evt The type of event
|
14288
|
+
* @param obj The object of the event. (can be an id, a string, an object, whatever is most relevant)
|
14289
|
+
*/
|
14290
|
+
this.fireEvent = function (evt, obj) {
|
14291
|
+
if (typeof this.config.custom_callbacks[evt] == 'function') {
|
14292
|
+
return this.config.custom_callbacks[evt](obj);
|
14293
|
+
}
|
14294
|
+
};
|
14295
|
+
/**
|
14296
|
+
* To set area dimensions.
|
14297
|
+
* This is needed to achieve the same result in all browsers.
|
14298
|
+
* @author adam
|
14299
|
+
* @date 10-12-2007 22:29:41
|
14300
|
+
* @param id The id of the area (canvas) to resize.
|
14301
|
+
* @param w The desired width in pixels.
|
14302
|
+
* @param h The desired height in pixels.
|
14303
|
+
*/
|
14304
|
+
this.setAreaSize = function (id, w, h) {
|
14305
|
+
if (id === null) {
|
14306
|
+
id = this.currentid;
|
14307
|
+
}
|
14308
|
+
var area = this.areas[id];
|
14309
|
+
if (w !== null) {
|
14310
|
+
area.width = w;
|
14311
|
+
area.style.width = (w) + 'px';
|
14312
|
+
area.setAttribute('width', w);
|
14313
|
+
}
|
14314
|
+
if (h !== null) {
|
14315
|
+
area.height = h;
|
14316
|
+
area.style.height = (h) + 'px';
|
14317
|
+
area.setAttribute('height', h);
|
14318
|
+
}
|
14319
|
+
};
|
14320
|
+
/**
|
14321
|
+
* Disable selection on a given object.
|
14322
|
+
* This is especially useful in Safari, where dragging around areas
|
14323
|
+
* keeps selecting all sorts of things.
|
14324
|
+
* @author Bret Taylor
|
14325
|
+
* @url http://ajaxcookbook.org/disable-text-selection/
|
14326
|
+
* @date 27-07-2008 1:57:45
|
14327
|
+
* @param element The DOM element on which you want to disable selection.
|
14328
|
+
*/
|
14329
|
+
this.disableSelection = function (element) {
|
14330
|
+
if (typeof element == 'undefined' || !element) {
|
14331
|
+
return false;
|
14332
|
+
}
|
14333
|
+
if (typeof element.onselectstart != "undefined") {
|
14334
|
+
element.onselectstart = function () {
|
14335
|
+
return false;
|
14336
|
+
};
|
14337
|
+
}
|
14338
|
+
if (typeof element.unselectable != "undefined") {
|
14339
|
+
element.unselectable = "on";
|
14340
|
+
}
|
14341
|
+
if (typeof element.style.MozUserSelect != "undefined") {
|
14342
|
+
element.style.MozUserSelect = "none";
|
14343
|
+
}
|
14344
|
+
};
|
14345
|
+
this.config = {
|
14346
|
+
custom_callbacks: {},
|
14347
|
+
//default color values
|
14348
|
+
CL_DRAW_SHAPE: '#d00',
|
14349
|
+
CL_DRAW_BG: '#fff',
|
14350
|
+
CL_NORM_SHAPE: '#d00',
|
14351
|
+
CL_NORM_BG: '#fff',
|
14352
|
+
CL_HIGHLIGHT_SHAPE: '#d00',
|
14353
|
+
CL_HIGHLIGHT_BG: '#fff',
|
14354
|
+
CL_KNOB: '#555',
|
14355
|
+
bounding_box: true,
|
14356
|
+
label: '%n',
|
14357
|
+
label_class: 'imgmap_label',
|
14358
|
+
label_style: 'font: bold 10px Arial',
|
14359
|
+
hint: '#%n %h',
|
14360
|
+
draw_opacity: '35',
|
14361
|
+
norm_opacity: '50',
|
14362
|
+
highlight_opacity: '70',
|
14363
|
+
cursor_default: 'crosshair' //the css cursor while hovering over the image
|
14364
|
+
};
|
14365
|
+
//browser sniff
|
14366
|
+
var navigator = window.navigator;
|
14367
|
+
var userAgent = window.navigator.userAgent;
|
14368
|
+
this.isMSIE = (navigator.appName == "Microsoft Internet Explorer");
|
14369
|
+
this.isSafari = userAgent.indexOf('Safari') != -1;
|
14370
|
+
this.setup(options);
|
14371
|
+
}
|
14372
|
+
return QMSCKEditorImageMapLib;
|
14373
|
+
}());
|
14374
|
+
/**
|
14375
|
+
* Trims a string.
|
14376
|
+
* Changed not to extend String but use own function for better compatibility.
|
14377
|
+
* @param str The string to trim.
|
14378
|
+
*/
|
14379
|
+
function trim(str) {
|
14380
|
+
return str.replace(/^\s+|\s+$/g, '');
|
14381
|
+
}
|
14382
|
+
;
|
14383
|
+
|
14384
|
+
function invalidURLValidator(regex) {
|
14385
|
+
return function (control) {
|
14386
|
+
var invalid = regex.test(control.value);
|
14387
|
+
return invalid ? { invalidURL: { value: 'control.value' } } : null;
|
14388
|
+
};
|
14389
|
+
}
|
14390
|
+
|
14391
|
+
var QMSCKEditorImageMapComponent = /** @class */ (function (_super) {
|
14392
|
+
__extends(QMSCKEditorImageMapComponent, _super);
|
14393
|
+
function QMSCKEditorImageMapComponent(renderer, cdr, dialog, translate, linkService, dialogRef, data, iconRegistry, sanitizer) {
|
14394
|
+
var _this = _super.call(this) || this;
|
14395
|
+
_this.renderer = renderer;
|
14396
|
+
_this.cdr = cdr;
|
14397
|
+
_this.dialog = dialog;
|
14398
|
+
_this.translate = translate;
|
14399
|
+
_this.linkService = linkService;
|
14400
|
+
_this.dialogRef = dialogRef;
|
14401
|
+
_this.data = data;
|
14402
|
+
_this.linkTypes = [];
|
14403
|
+
_this.targets = [];
|
14404
|
+
_this.protocols = [];
|
14405
|
+
_this.modes = [];
|
14406
|
+
_this.zoomTypes = [];
|
14407
|
+
_this.url = '';
|
14408
|
+
_this.processedUrl = '';
|
14409
|
+
_this.selectedMode = ImageModeName.Rectangle;
|
14410
|
+
_this.selectedLinkType = exports.LinkType.url;
|
14411
|
+
_this.selectedTarget = exports.TargetTypeName.new;
|
14412
|
+
_this.selectedProtocol = exports.ProtocolTypeName.http;
|
14413
|
+
_this.selectedZoom = 1.0;
|
14414
|
+
_this.protocolRegex = /^(http|https|ftp|news):\/\/(?=.)/i;
|
14415
|
+
_this.javascriptLinkRegex = /javascript\:/i;
|
14416
|
+
_this.documentId = 0;
|
14417
|
+
//anchorTitle = '';
|
14418
|
+
_this.anchorText = '';
|
14419
|
+
//anchorByName = '';
|
14420
|
+
_this.advisoryTitle = '';
|
14421
|
+
_this.isUrlProcessing = false;
|
14422
|
+
_this.naturalImageWidth = 0;
|
14423
|
+
_this.naturalImageHeight = 0;
|
14424
|
+
_this.currentAreaId = -1;
|
14425
|
+
_this.showImageMapInformation = false;
|
14426
|
+
_this.anchorDocuments = [];
|
14427
|
+
//documentAnchors: IAnchor[];
|
14428
|
+
_this.imageListeners = [];
|
14429
|
+
_this.imageMapData = data;
|
14430
|
+
_this.naturalImageHeight = _this.imageMapData.imageHeight;
|
14431
|
+
_this.naturalImageWidth = _this.imageMapData.imageWidth;
|
14432
|
+
_this.initFormControl();
|
14433
|
+
_this.initSvgIcons(iconRegistry, sanitizer);
|
14434
|
+
return _this;
|
14435
|
+
}
|
14436
|
+
QMSCKEditorImageMapComponent.prototype.initDefaultValues = function () {
|
14437
|
+
this.selectedLinkType = exports.LinkType.url;
|
14438
|
+
this.selectedTarget = exports.TargetTypeName.new;
|
14439
|
+
this.selectedProtocol = exports.ProtocolTypeName.http;
|
14440
|
+
this.url = '';
|
14441
|
+
this.processedUrl = '';
|
14442
|
+
this.advisoryTitle = '';
|
14443
|
+
this.anchorText = '';
|
14444
|
+
};
|
14445
|
+
QMSCKEditorImageMapComponent.prototype.initSvgIcons = function (iconRegistry, sanitizer) {
|
14446
|
+
iconRegistry.addSvgIconLiteral('vector-pointer', sanitizer.bypassSecurityTrustHtml(IconSvg.VECTOR_POINTER));
|
14447
|
+
iconRegistry.addSvgIconLiteral('vector-circle', sanitizer.bypassSecurityTrustHtml(IconSvg.VECTOR_CIRCLE));
|
14448
|
+
iconRegistry.addSvgIconLiteral('vector-rectangle', sanitizer.bypassSecurityTrustHtml(IconSvg.VECTOR_RECTANGLE));
|
14449
|
+
iconRegistry.addSvgIconLiteral('vector-polygon', sanitizer.bypassSecurityTrustHtml(IconSvg.VECTOR_POLYGON));
|
14450
|
+
iconRegistry.addSvgIconLiteral('vector-remove', sanitizer.bypassSecurityTrustHtml(IconSvg.VECTOR_REMOVE));
|
14451
|
+
};
|
14452
|
+
QMSCKEditorImageMapComponent.prototype.initFormControl = function () {
|
14453
|
+
var valiationControls = {
|
14454
|
+
targetList: new forms.FormControl(),
|
14455
|
+
protocolList: new forms.FormControl(),
|
14456
|
+
anchorTextList: new forms.FormControl(),
|
14457
|
+
modeList: new forms.FormControl(),
|
14458
|
+
zoomList: new forms.FormControl(),
|
14459
|
+
linkTypeList: new forms.FormControl()
|
14460
|
+
};
|
14461
|
+
if (this.imageMapData.linkJavaScriptLinksAllowed == true) {
|
14462
|
+
valiationControls['url'] = new forms.FormControl('', [forms.Validators.required]);
|
14463
|
+
}
|
14464
|
+
else {
|
14465
|
+
valiationControls['url'] = new forms.FormControl('', [forms.Validators.required, invalidURLValidator(this.javascriptLinkRegex)]);
|
14466
|
+
}
|
14467
|
+
this.imageMapFormGroup = new forms.FormGroup(valiationControls);
|
14468
|
+
};
|
14469
|
+
QMSCKEditorImageMapComponent.prototype.initLinkType = function () {
|
14470
|
+
if (this.linkTypes) {
|
14471
|
+
this.linkTypes.push({ id: exports.LinkType.url, name: this.LANG.QMSCKEDITOR.LINK_URL });
|
14472
|
+
this.linkTypes.push({
|
14473
|
+
id: exports.LinkType.anchorText,
|
14474
|
+
name: this.LANG.QMSCKEDITOR.LINK_ANCHOR_IN_TEXT
|
14475
|
+
});
|
14476
|
+
}
|
14477
|
+
};
|
14478
|
+
QMSCKEditorImageMapComponent.prototype.initTarget = function () {
|
14479
|
+
if (this.targets) {
|
14480
|
+
this.targets.push({ id: exports.TargetTypeName.new, name: this.LANG.QMSCKEDITOR.TARTGET_NEW });
|
14481
|
+
this.targets.push({ id: exports.TargetTypeName.same, name: this.LANG.QMSCKEDITOR.TARGET_SAME });
|
14482
|
+
}
|
14483
|
+
};
|
14484
|
+
QMSCKEditorImageMapComponent.prototype.initProtocol = function () {
|
14485
|
+
if (this.protocols) {
|
14486
|
+
this.protocols.push({ id: exports.ProtocolTypeName.http, name: this.LANG.QMSCKEDITOR.PROTOCOL_HTTP });
|
14487
|
+
this.protocols.push({ id: exports.ProtocolTypeName.https, name: this.LANG.QMSCKEDITOR.PROTOCOL_HTTPS });
|
14488
|
+
this.protocols.push({ id: exports.ProtocolTypeName.ftp, name: this.LANG.QMSCKEDITOR.PROTOCOL_FTP });
|
14489
|
+
this.protocols.push({ id: exports.ProtocolTypeName.news, name: this.LANG.QMSCKEDITOR.PROTOCOL_NEW });
|
14490
|
+
this.protocols.push({ id: exports.ProtocolTypeName.other, name: this.LANG.QMSCKEDITOR.PROTOCOL_OTHER });
|
14491
|
+
}
|
14492
|
+
};
|
14493
|
+
QMSCKEditorImageMapComponent.prototype.initModes = function () {
|
14494
|
+
if (this.modes) {
|
14495
|
+
this.modes.push({ id: ImageModeName.Pointer, name: this.LANG.QMSCKEDITOR.IMAGE_MODE_POINTER, icon: "vector-pointer" });
|
14496
|
+
this.modes.push({ id: ImageModeName.Rectangle, name: this.LANG.QMSCKEDITOR.IMAGE_MODE_RECTANGLE, icon: "vector-rectangle" });
|
14497
|
+
this.modes.push({ id: ImageModeName.Circle, name: this.LANG.QMSCKEDITOR.IMAGE_MODE_CIRCLE, icon: "vector-circle" });
|
14498
|
+
this.modes.push({ id: ImageModeName.Polygon, name: this.LANG.QMSCKEDITOR.IMAGE_MODE_POLYGON, icon: "vector-polygon" });
|
14499
|
+
this.modes.push({ id: ImageModeName.Remove, name: this.LANG.QMSCKEDITOR.IMAGE_MODE_REMOVE, icon: "vector-remove" });
|
14500
|
+
}
|
14501
|
+
};
|
14502
|
+
QMSCKEditorImageMapComponent.prototype.initZoomTypes = function () {
|
14503
|
+
if (this.zoomTypes) {
|
14504
|
+
this.zoomTypes.push({ id: 0.25, name: "25%" });
|
14505
|
+
this.zoomTypes.push({ id: 0.5, name: "50%" });
|
14506
|
+
this.zoomTypes.push({ id: 1.0, name: "100%" });
|
14507
|
+
this.zoomTypes.push({ id: 2.0, name: "200%" });
|
14508
|
+
this.zoomTypes.push({ id: 3.0, name: "300%" });
|
14509
|
+
}
|
14510
|
+
};
|
14511
|
+
QMSCKEditorImageMapComponent.prototype.initAnchor = function () {
|
14512
|
+
this.anchors = [];
|
14513
|
+
this.anchors = [{ value: 0, viewValue: '', anchorValue: exports.LinkAnchor.Blank }];
|
14514
|
+
};
|
14515
|
+
QMSCKEditorImageMapComponent.prototype.ngOnInit = function () {
|
14516
|
+
var _this = this;
|
14517
|
+
this.translate.getLanguageSubject$.pipe(operators.takeUntil(this.ngUnsubcribe)).subscribe(function (res) {
|
14518
|
+
if (res) {
|
14519
|
+
_this.LANG = _this.translate.getObjectLang(res);
|
14520
|
+
}
|
14521
|
+
});
|
14522
|
+
this.initLinkType();
|
14523
|
+
this.initTarget();
|
14524
|
+
this.initProtocol();
|
14525
|
+
this.initModes();
|
14526
|
+
this.initZoomTypes();
|
14527
|
+
};
|
14528
|
+
QMSCKEditorImageMapComponent.prototype.ngOnDestroy = function () {
|
14529
|
+
_super.prototype.ngOnDestroy.call(this);
|
14530
|
+
if (this.imageListeners && this.imageListeners.length > 0) {
|
14531
|
+
this.imageListeners.forEach(function (listener) {
|
14532
|
+
listener();
|
14533
|
+
});
|
14534
|
+
}
|
14535
|
+
};
|
14536
|
+
QMSCKEditorImageMapComponent.prototype.onImageLoad = function () {
|
14537
|
+
this.naturalImageHeight = this.naturalImageHeight != 0 ? this.naturalImageHeight : this.myImageRef.nativeElement.naturalHeight;
|
14538
|
+
this.naturalImageWidth = this.naturalImageWidth != 0 ? this.naturalImageWidth : this.myImageRef.nativeElement.naturalWidth;
|
14539
|
+
this.setImageSize();
|
14540
|
+
this.myImageMap.setMapJson({
|
14541
|
+
name: this.imageMapData.name,
|
14542
|
+
areas: this.imageMapData.areas
|
14543
|
+
});
|
14544
|
+
if (this.imageMapData.areas && this.imageMapData.areas.length > 0) {
|
14545
|
+
this.myImageMap.blurArea(this.myImageMap.currentid);
|
14546
|
+
this.myImageMap.currentid = 0;
|
14547
|
+
this.myImageMap.selectedId = 0;
|
14548
|
+
this.onSelectArea(this.myImageMap.areas[0]);
|
14549
|
+
this.myImageMap.highlightArea(0);
|
14550
|
+
}
|
14551
|
+
};
|
14552
|
+
QMSCKEditorImageMapComponent.prototype.ngAfterViewInit = function () {
|
14553
|
+
var _this = this;
|
14554
|
+
if (this.myImageRef) {
|
14555
|
+
this.imageListeners.push(this.renderer.listen(this.myImageRef.nativeElement, 'load', function () {
|
14556
|
+
_this.onImageLoad();
|
14557
|
+
}));
|
14558
|
+
}
|
14559
|
+
// Avoid drag&drop of the image
|
14560
|
+
this.myImageMap = new QMSCKEditorImageMapLib({
|
14561
|
+
custom_callbacks: {
|
14562
|
+
"onAddArea": this.onAddArea.bind(this),
|
14563
|
+
'onSelectArea': this.onSelectArea.bind(this),
|
14564
|
+
'onRemoveArea': this.onRemoveArea.bind(this),
|
14565
|
+
'onStatusMessage': this.onStatusMessage.bind(this)
|
14566
|
+
},
|
14567
|
+
imageElement: this.myImageRef.nativeElement,
|
14568
|
+
bounding_box: false,
|
14569
|
+
CL_DRAW_SHAPE: '#F00',
|
14570
|
+
CL_NORM_SHAPE: '#AAA',
|
14571
|
+
CL_HIGHLIGHT_SHAPE: '#F00',
|
14572
|
+
strings: {
|
14573
|
+
"POLYGON_DRAW": this.LANG.QMSCKEDITOR.POLYGON_DRAW,
|
14574
|
+
"RECTANGLE_DRAW": this.LANG.QMSCKEDITOR.RECTANGLE_DRAW,
|
14575
|
+
"SQUARE_DRAW": this.LANG.QMSCKEDITOR.SQUARE_DRAW,
|
14576
|
+
'READY': '',
|
14577
|
+
'RECTANGLE_MOVE': '',
|
14578
|
+
'RECTANGLE_RESIZE_TOP': '',
|
14579
|
+
'RECTANGLE_RESIZE_RIGHT': '',
|
14580
|
+
'RECTANGLE_RESIZE_BOTTOM': '',
|
14581
|
+
'RECTANGLE_RESIZE_LEFT': '',
|
14582
|
+
'SQUARE_MOVE': '',
|
14583
|
+
'SQUARE_RESIZE_TOP': '',
|
14584
|
+
'SQUARE_RESIZE_RIGHT': '',
|
14585
|
+
'SQUARE_RESIZE_BOTTOM': '',
|
14586
|
+
'SQUARE_RESIZE_LEFT': '',
|
14587
|
+
'POLYGON_MOVE': ''
|
14588
|
+
}
|
14589
|
+
});
|
14590
|
+
};
|
14591
|
+
QMSCKEditorImageMapComponent.prototype.parseLinkUrl = function (url, defaultProtocolName) {
|
14592
|
+
var protocol = this.protocolRegex.exec(url);
|
14593
|
+
if (protocol) {
|
14594
|
+
this.processedUrl = url.substr(protocol[0].length);
|
14595
|
+
this.url = this.processedUrl;
|
14596
|
+
this.selectedProtocol = protocol[0].toLowerCase();
|
14597
|
+
}
|
14598
|
+
else if (this.javascriptLinkRegex.test(url) && !this.imageMapData.linkJavaScriptLinksAllowed) {
|
14599
|
+
this.selectedProtocol = exports.ProtocolTypeName.http;
|
14600
|
+
this.processedUrl = '';
|
14601
|
+
this.url = this.processedUrl;
|
14602
|
+
}
|
14603
|
+
else {
|
14604
|
+
this.processedUrl = url;
|
14605
|
+
this.url = this.processedUrl;
|
14606
|
+
if (!!this.selectedProtocol) {
|
14607
|
+
this.selectedProtocol = defaultProtocolName || exports.ProtocolTypeName.http;
|
14608
|
+
}
|
14609
|
+
}
|
14610
|
+
};
|
14611
|
+
QMSCKEditorImageMapComponent.prototype.onSelectArea = function (area) {
|
14612
|
+
this.currentAreaId = area.aid;
|
14613
|
+
this.showImageMapInformation = true;
|
14614
|
+
if (this.selectedMode == ImageModeName.Remove) {
|
14615
|
+
this.myImageMap.removeArea(this.currentAreaId);
|
14616
|
+
}
|
14617
|
+
else {
|
14618
|
+
if (area.ahref.match(/^#(.*)$/)) {
|
14619
|
+
this.anchorText = area.ahref.slice(1);
|
14620
|
+
this.selectedLinkType = exports.LinkType.anchorText;
|
14621
|
+
}
|
14622
|
+
else {
|
14623
|
+
this.selectedLinkType = exports.LinkType.url;
|
14624
|
+
this.parseLinkUrl(area.ahref);
|
14625
|
+
}
|
14626
|
+
this.selectedTarget = area.atarget;
|
14627
|
+
this.advisoryTitle = area.aalt;
|
14628
|
+
this.cdr.detectChanges();
|
14629
|
+
}
|
14630
|
+
};
|
14631
|
+
QMSCKEditorImageMapComponent.prototype.onRemoveArea = function () {
|
14632
|
+
this.currentAreaId = -1;
|
14633
|
+
this.showImageMapInformation = false;
|
14634
|
+
};
|
14635
|
+
QMSCKEditorImageMapComponent.prototype.removeMap = function () {
|
14636
|
+
this.currentAreaId = -1;
|
14637
|
+
this.showImageMapInformation = false;
|
14638
|
+
this.myImageMap.removeAllAreas();
|
14639
|
+
};
|
14640
|
+
QMSCKEditorImageMapComponent.prototype.onStatusMessage = function (text) {
|
14641
|
+
if (this.myStatusRef) {
|
14642
|
+
this.myStatusRef.nativeElement.innerHTML = text || '';
|
14643
|
+
}
|
14644
|
+
};
|
14645
|
+
QMSCKEditorImageMapComponent.prototype.onUrlKeyup = function () {
|
14646
|
+
this.isUrlProcessing = true;
|
14647
|
+
if (this.url != this.processedUrl) {
|
14648
|
+
this.parseLinkUrl(this.url);
|
14649
|
+
this.updateAreaValues();
|
14650
|
+
}
|
14651
|
+
this.isUrlProcessing = false;
|
14652
|
+
};
|
14653
|
+
QMSCKEditorImageMapComponent.prototype.onUrlChange = function () {
|
14654
|
+
if (!this.isUrlProcessing) {
|
14655
|
+
this.onUrlKeyup();
|
14656
|
+
}
|
14657
|
+
};
|
14658
|
+
QMSCKEditorImageMapComponent.prototype.onAnchorTextChange = function () {
|
14659
|
+
this.updateAreaValues();
|
14660
|
+
};
|
14661
|
+
QMSCKEditorImageMapComponent.prototype.onProtocolChange = function () {
|
14662
|
+
this.updateAreaValues();
|
14663
|
+
};
|
14664
|
+
QMSCKEditorImageMapComponent.prototype.onTargetChange = function () {
|
14665
|
+
this.updateAreaValues();
|
14666
|
+
};
|
14667
|
+
QMSCKEditorImageMapComponent.prototype.onAddArea = function (id) {
|
14668
|
+
this.currentAreaId = id;
|
14669
|
+
this.showImageMapInformation = true;
|
14670
|
+
this.initDefaultValues();
|
14671
|
+
this.updateAreaValues();
|
14672
|
+
};
|
14673
|
+
QMSCKEditorImageMapComponent.prototype.updateAreaValues = function () {
|
14674
|
+
if (this.currentAreaId > -1) {
|
14675
|
+
var ahref = this.buildUrlWithProtocol();
|
14676
|
+
if (this.selectedLinkType == exports.LinkType.anchorText) {
|
14677
|
+
this.myImageMap.areas[this.currentAreaId].atarget = exports.TargetTypeName.same;
|
14678
|
+
this.myImageMap.areas[this.currentAreaId].aalt = this.anchorText;
|
14679
|
+
}
|
14680
|
+
else {
|
14681
|
+
this.myImageMap.areas[this.currentAreaId].atarget = this.selectedTarget || exports.TargetTypeName.new;
|
14682
|
+
this.myImageMap.areas[this.currentAreaId].aalt = this.advisoryTitle;
|
14683
|
+
}
|
14684
|
+
this.myImageMap.areas[this.currentAreaId].ahref = ahref;
|
14685
|
+
}
|
14686
|
+
};
|
14687
|
+
QMSCKEditorImageMapComponent.prototype.buildUrlWithProtocol = function () {
|
14688
|
+
if (this.selectedLinkType == exports.LinkType.anchorText) {
|
14689
|
+
return '#' + (this.anchorText || '');
|
14690
|
+
}
|
14691
|
+
if (!!this.processedUrl) {
|
14692
|
+
return this.selectedProtocol + this.processedUrl;
|
14693
|
+
}
|
14694
|
+
return '';
|
14695
|
+
};
|
14696
|
+
QMSCKEditorImageMapComponent.prototype.ngAfterViewChecked = function () {
|
14697
|
+
this.cdr.detectChanges();
|
14698
|
+
};
|
14699
|
+
QMSCKEditorImageMapComponent.prototype.onCloseDialog = function () {
|
14700
|
+
this.dialogRef.close();
|
14701
|
+
};
|
14702
|
+
QMSCKEditorImageMapComponent.prototype.onModeChange = function (e) {
|
14703
|
+
this.selectedMode = e.value;
|
14704
|
+
if (this.selectedMode == ImageModeName.Pointer || this.selectedMode == ImageModeName.Remove) {
|
14705
|
+
this.myImageMap.is_drawing = 0;
|
14706
|
+
this.myImageMap.nextShape = '';
|
14707
|
+
this.myImageRef.nativeElement.style.cursor = 'default';
|
14708
|
+
}
|
14709
|
+
else {
|
14710
|
+
this.myImageMap.nextShape = this.selectedMode;
|
14711
|
+
this.myImageRef.nativeElement.style.cursor = 'crosshair';
|
14712
|
+
}
|
14713
|
+
};
|
14714
|
+
QMSCKEditorImageMapComponent.prototype.onZoomChange = function () {
|
14715
|
+
this.setImageSize();
|
14716
|
+
if (this.myImageMap) {
|
14717
|
+
this.myImageMap.scaleAllAreas(this.selectedZoom);
|
14718
|
+
}
|
14719
|
+
};
|
14720
|
+
QMSCKEditorImageMapComponent.prototype.onLinkTypeChange = function () {
|
14721
|
+
if (this.selectedLinkType === exports.LinkType.anchorText) {
|
14722
|
+
this.getEditorAnchor();
|
14723
|
+
}
|
14724
|
+
this.updateAreaValues();
|
14725
|
+
};
|
14726
|
+
QMSCKEditorImageMapComponent.prototype.getEditorAnchor = function () {
|
14727
|
+
this.anchorDocuments = [];
|
14728
|
+
if (this.imageMapData.editorContent) {
|
14729
|
+
this.anchorDocuments.push({
|
14730
|
+
id: 0,
|
14731
|
+
entityId: 0,
|
14732
|
+
documentId: 0,
|
14733
|
+
documentTypeId: 0,
|
14734
|
+
richText: this.imageMapData.editorContent
|
14735
|
+
});
|
14736
|
+
}
|
14737
|
+
this.setAnchorDocument(this.anchorDocuments);
|
14738
|
+
this.editorAnchors = this.anchors;
|
14739
|
+
};
|
14740
|
+
QMSCKEditorImageMapComponent.prototype.setImageSize = function () {
|
14741
|
+
if (this.myImageRef) {
|
14742
|
+
var width = this.naturalImageWidth * this.selectedZoom;
|
14743
|
+
var height = this.naturalImageHeight * this.selectedZoom;
|
14744
|
+
this.myImageRef.nativeElement.setAttribute("width", width + "px;");
|
14745
|
+
this.myImageRef.nativeElement.setAttribute("height", height + "px;");
|
14746
|
+
this.myImageRef.nativeElement.style.width = width + "px";
|
14747
|
+
this.myImageRef.nativeElement.style.height = height + "px";
|
14748
|
+
this.myImageRef.nativeElement.style.cursor = this.selectedMode == ImageModeName.Pointer || this.selectedMode == ImageModeName.Remove ? 'default' : 'crosshair';
|
14749
|
+
}
|
14750
|
+
};
|
14751
|
+
QMSCKEditorImageMapComponent.prototype.eHandbook = function (isOnlyDocument, isAnchorDocument) {
|
14752
|
+
var _this = this;
|
14753
|
+
var data = new QMSCKEditorRelation();
|
14754
|
+
data.isOnlyDocument = isOnlyDocument;
|
14755
|
+
data.isEnableFolder = !isOnlyDocument;
|
14756
|
+
var dialogTemplate = this.dialog.open(QMSCKEditorRelatedComponent, {
|
14757
|
+
width: '650px',
|
14758
|
+
height: '650px',
|
14759
|
+
data: data,
|
14760
|
+
disableClose: true
|
14761
|
+
});
|
14762
|
+
dialogTemplate
|
14763
|
+
.afterClosed()
|
14764
|
+
.pipe(operators.takeUntil(this.ngUnsubcribe))
|
14765
|
+
.subscribe(function (result) {
|
14766
|
+
if (result) {
|
14767
|
+
if (isAnchorDocument) {
|
14768
|
+
_this.documentId = result.id;
|
14769
|
+
//this.anchorTitle = `${result.title}(${result.id})`;
|
14770
|
+
_this.getAnchorDocument(result.id);
|
14771
|
+
}
|
14772
|
+
else {
|
14773
|
+
_this.parseLinkUrl(result.url);
|
14774
|
+
_this.selectedProtocol = exports.ProtocolTypeName.other;
|
14775
|
+
if (!_this.advisoryTitle) {
|
14776
|
+
_this.advisoryTitle = result.title;
|
14777
|
+
}
|
14778
|
+
}
|
14779
|
+
_this.updateAreaValues();
|
14780
|
+
}
|
14781
|
+
});
|
14782
|
+
};
|
14783
|
+
QMSCKEditorImageMapComponent.prototype.getAnchorDocument = function (documentId) {
|
14784
|
+
var _this = this;
|
14785
|
+
this.linkService
|
14786
|
+
.getAnchorDocumentList(documentId)
|
14787
|
+
.pipe(operators.takeUntil(this.ngUnsubcribe))
|
14788
|
+
.subscribe(function (res) {
|
14789
|
+
if (res) {
|
14790
|
+
_this.anchorDocuments = res;
|
14791
|
+
_this.setAnchorDocument(_this.anchorDocuments);
|
14792
|
+
//this.documentAnchors = this.anchors;
|
14793
|
+
}
|
14794
|
+
else {
|
14795
|
+
_this.anchorDocuments = [];
|
14796
|
+
_this.setAnchorDocument(_this.anchorDocuments);
|
14797
|
+
//this.documentAnchors = this.anchors;
|
14798
|
+
}
|
14799
|
+
});
|
14800
|
+
};
|
14801
|
+
QMSCKEditorImageMapComponent.prototype.setAnchorDocument = function (anchorDocument) {
|
14802
|
+
var _this = this;
|
14803
|
+
this.initAnchor();
|
14804
|
+
var id = 3;
|
14805
|
+
if (anchorDocument) {
|
14806
|
+
anchorDocument.forEach(function (e) {
|
14807
|
+
var div = document.createElement('div');
|
14808
|
+
div.innerHTML = e.richText;
|
14809
|
+
var domContent = div;
|
14810
|
+
var aTags = domContent.getElementsByTagName('a');
|
14811
|
+
if (aTags) {
|
14812
|
+
var _loop_1 = function (i) {
|
14813
|
+
var tag = aTags[i];
|
14814
|
+
if (tag.name) {
|
14815
|
+
var index = _this.anchors.findIndex(function (x) {
|
14816
|
+
return x.anchorValue === tag.name;
|
14817
|
+
});
|
14818
|
+
if (index < 0) {
|
14819
|
+
_this.anchors.push({
|
14820
|
+
value: id,
|
14821
|
+
viewValue: tag.name,
|
14822
|
+
anchorValue: tag.name
|
14823
|
+
});
|
14824
|
+
id += 1;
|
14825
|
+
}
|
14826
|
+
}
|
14827
|
+
};
|
14828
|
+
// tslint:disable-next-line:prefer-for-of
|
14829
|
+
for (var i = 0; i < aTags.length; i++) {
|
14830
|
+
_loop_1(i);
|
14831
|
+
}
|
14832
|
+
}
|
14833
|
+
});
|
14834
|
+
}
|
14835
|
+
// this.anchors.push({
|
14836
|
+
// value: 1,
|
14837
|
+
// viewValue: this.LANG.QMSCKEDITOR.ANCHOR_ATTACHMENT,
|
14838
|
+
// anchorValue: LinkAnchor.Attachment
|
14839
|
+
// });
|
14840
|
+
// this.anchors.push({
|
14841
|
+
// value: 2,
|
14842
|
+
// viewValue: this.LANG.QMSCKEDITOR.ANCHOR_RELATED_DOCUMENT,
|
14843
|
+
// anchorValue: LinkAnchor.Related
|
14844
|
+
// });
|
14845
|
+
};
|
14846
|
+
QMSCKEditorImageMapComponent.prototype.attachment = function () {
|
14847
|
+
var _this = this;
|
14848
|
+
var data = new QMSCKEditorParamter();
|
14849
|
+
data.module = this.imageMapData.module;
|
14850
|
+
data.entityId = this.imageMapData.entityId;
|
14851
|
+
var dialogTemplate = this.dialog.open(LinkAttachmentComponent, {
|
14852
|
+
width: '650px',
|
14853
|
+
height: '650px',
|
14854
|
+
data: data,
|
14855
|
+
disableClose: true
|
14856
|
+
});
|
14857
|
+
dialogTemplate
|
14858
|
+
.afterClosed()
|
14859
|
+
.pipe(operators.takeUntil(this.ngUnsubcribe))
|
14860
|
+
.subscribe(function (result) {
|
14861
|
+
if (result) {
|
14862
|
+
_this.parseLinkUrl(result.url);
|
14863
|
+
_this.selectedProtocol = exports.ProtocolTypeName.other;
|
14864
|
+
if (!_this.advisoryTitle) {
|
14865
|
+
_this.advisoryTitle = result.title;
|
14866
|
+
}
|
14867
|
+
_this.updateAreaValues();
|
14868
|
+
}
|
14869
|
+
});
|
14870
|
+
};
|
14871
|
+
QMSCKEditorImageMapComponent.prototype.save = function () {
|
14872
|
+
var data = this.myImageMap.getMapJson();
|
14873
|
+
data.imageHeight = this.naturalImageHeight;
|
14874
|
+
data.imageWidth = this.naturalImageWidth;
|
14875
|
+
this.dialogRef.close(data);
|
14876
|
+
};
|
14877
|
+
QMSCKEditorImageMapComponent.prototype.cancel = function () {
|
14878
|
+
this.dialogRef.close();
|
14879
|
+
};
|
14880
|
+
return QMSCKEditorImageMapComponent;
|
14881
|
+
}(QMSCKEditorBaseComponent));
|
14882
|
+
QMSCKEditorImageMapComponent.decorators = [
|
14883
|
+
{ type: i0.Component, args: [{
|
14884
|
+
selector: 'app-qmsck-imagemap',
|
14885
|
+
template: "<div id=\"qmsckeditor-imagemap\" class=\"qmsckeditor qmsckeditor__imagemap__container\">\r\n <div id=\"qmsckeditor-imagemap-header\">\r\n <span id=\"qmsckeditor-imagemap-header_001\" mat-icon-button class=\"qmsckeditor button__close\"\r\n (click)=\"onCloseDialog()\">\r\n <mat-icon>close</mat-icon>\r\n </span>\r\n <div id=\"qmsckeditor-imagemap-header_002\" mat-dialog-content>\r\n <h2 id=\"qmsckeditor-imagemap_002_001\">\r\n {{ LANG.QMSCKEDITOR.IMAGE_MAP_PROPERTIES }}\r\n </h2>\r\n </div>\r\n </div>\r\n <div id=\"qmsckeditor-imagemap-content\">\r\n <div id=\"qmsckeditor-imagemap-content_001\" class=\"col-12 mt-1 pl-2 pr-2\">\r\n <mat-expansion-panel id=\"qmsckeditor-imagemap-panel\" [expanded]=\"true\" (opened)=\"(true)\" (closed)=\"(false)\">\r\n <div id=\"qmsckeditor-imagemap-panel_001\">\r\n <div id=\"qmsckeditor-imagemap-panel_001_001\" class=\"qmsckeditor__imagemap__information\">\r\n <form [formGroup]=\"imageMapFormGroup\">\r\n <div class=\"row\">\r\n <div class=\"col-9\">\r\n <mat-button-toggle-group [(ngModel)]=\"selectedMode\" formControlName=\"modeList\"\r\n (change)=\"onModeChange($event)\">\r\n <mat-button-toggle *ngFor=\"let mode of modes\" [value]=\"mode.id\"\r\n [matTooltip]=\"mode.name\">\r\n <mat-icon color=\"red\" [svgIcon]=\"mode.icon\" aria-hidden=\"true\">\r\n </mat-icon>\r\n </mat-button-toggle>\r\n </mat-button-toggle-group>\r\n <span style=\"margin-left: 15px;\" #myStatus></span>\r\n </div>\r\n <div class=\"col-3\">\r\n <mat-form-field appearance=\"fill\" class=\"col-12 pl-3 pr-3 pb-1\">\r\n <mat-label>{{ LANG.QMSCKEDITOR.ZOOM }}</mat-label>\r\n <mat-select [(ngModel)]=\"selectedZoom\" formControlName=\"zoomList\"\r\n (ngModelChange)=\"onZoomChange()\" disableOptionCentering>\r\n <mat-option *ngFor=\"let zoomType of zoomTypes\" [value]=\"zoomType.id\">\r\n {{ zoomType.name }}\r\n </mat-option>\r\n </mat-select>\r\n </mat-form-field>\r\n </div>\r\n </div>\r\n <div class=\"row\" [ngClass]=\"{'hidden': !showImageMapInformation}\">\r\n <div class=\"col-3\">\r\n <mat-form-field appearance=\"fill\" class=\"col-12 pl-3 pr-3 pb-1\">\r\n <mat-label>{{ LANG.QMSCKEDITOR.LINK_TYPE }}</mat-label>\r\n <mat-select [(ngModel)]=\"selectedLinkType\" formControlName=\"linkTypeList\"\r\n (ngModelChange)=\"onLinkTypeChange()\" disableOptionCentering>\r\n <mat-option *ngFor=\"let link of linkTypes\" [value]=\"link.id\">\r\n {{ link.name }}\r\n </mat-option>\r\n </mat-select>\r\n </mat-form-field>\r\n </div>\r\n <div class=\"col-3\" *ngIf=\"selectedLinkType === 0\">\r\n <mat-form-field appearance=\"fill\" class=\"col-12 pl-3 pr-3 pb-1\">\r\n <mat-label>{{ LANG.QMSCKEDITOR.TARGET }}</mat-label>\r\n <mat-select [(ngModel)]=\"selectedTarget\" formControlName=\"targetList\"\r\n (ngModelChange)=\"onTargetChange()\" disableOptionCentering>\r\n <mat-option *ngFor=\"let target of targets\" [value]=\"target.id\">\r\n {{ target.name }}\r\n </mat-option>\r\n </mat-select>\r\n </mat-form-field>\r\n </div>\r\n </div>\r\n <div class=\"row\" [ngClass]=\"{'hidden': !showImageMapInformation}\"\r\n *ngIf=\"selectedLinkType === 1\">\r\n <div class=\"col-3\">\r\n <mat-form-field appearance=\"fill\" class=\"col-12 pl-3 pr-\">\r\n <mat-label>{{ LANG.QMSCKEDITOR.ANCHOR_BY_NAME }}</mat-label>\r\n <mat-select [(ngModel)]=\"anchorText\" formControlName=\"anchorTextList\"\r\n (ngModelChange)=\"onAnchorTextChange()\">\r\n <mat-option *ngFor=\"let editorAnchor of editorAnchors\"\r\n [value]=\"editorAnchor.anchorValue\" disableOptionCentering>\r\n {{ editorAnchor.viewValue }}\r\n </mat-option>\r\n </mat-select>\r\n </mat-form-field>\r\n </div>\r\n </div>\r\n <div class=\"row\" [ngClass]=\"{'hidden': !showImageMapInformation}\"\r\n *ngIf=\"selectedLinkType === 0\">\r\n <div class=\"col-3\">\r\n <mat-form-field appearance=\"fill\" class=\"col-12 pl-3 pr-3 pb-1\">\r\n <mat-label>{{ LANG.QMSCKEDITOR.PROTOCOL }}</mat-label>\r\n <mat-select [(ngModel)]=\"selectedProtocol\" formControlName=\"protocolList\"\r\n (ngModelChange)=\"onProtocolChange()\" disableOptionCentering>\r\n <mat-option *ngFor=\"let protocol of protocols\" [value]=\"protocol.id\">\r\n {{ protocol.name }}\r\n </mat-option>\r\n </mat-select>\r\n </mat-form-field>\r\n </div>\r\n <div class=\"col-5\">\r\n <mat-form-field appearance=\"fill\" class=\"col-12 pl-3 pr-3 pb-1\">\r\n <mat-label>{{ LANG.QMSCKEDITOR.LINK_URL }}</mat-label>\r\n <input matInput [(ngModel)]=\"url\" name=\"url\" formControlName=\"url\"\r\n (ngModelChange)=\"onUrlChange()\" (keyup)=\"onUrlKeyup()\" />\r\n <mat-error *ngIf=\"imageMapFormGroup.get('url').hasError('required')\">{{\r\n LANG.QMSCKEDITOR.REQUIRED_URL }}\r\n </mat-error>\r\n <mat-error *ngIf=\"imageMapFormGroup.get('url').hasError('invalidURL')\">{{\r\n LANG.QMSCKEDITOR.INVALID_URL }}</mat-error>\r\n </mat-form-field>\r\n </div>\r\n <div class=\"col-4\">\r\n <div class=\"row button__groups\">\r\n <div class=\"col-6\">\r\n <button class=\"save\" mat-stroked-button (click)=\"attachment()\">\r\n {{ LANG.QMSCKEDITOR.ATTACHMENT }}\r\n </button>\r\n </div>\r\n <div class=\"col-6\">\r\n <button class=\"save\" mat-stroked-button (click)=\"eHandbook(false, false)\">\r\n {{ LANG.QMSCKEDITOR.HANDBOOK }}\r\n </button>\r\n </div>\r\n </div>\r\n </div>\r\n </div>\r\n </form>\r\n </div>\r\n <div id=\"qmsckeditor-imagemap-panel_001_002\" class=\"qmsckeditor__imagemap__map\">\r\n <img #myImage [src]=\"imageMapData.imageUrl\">\r\n </div>\r\n <div id=\"qmsckeditor-imagemap-panel_001_003\" class=\"qmsckeditor button__groups row mr-0 ml-0 mt-4\">\r\n <div class=\"col-4 pr-0\">\r\n <button class=\"save\" mat-flat-button (click)=\"removeMap()\">\r\n {{ LANG.QMSCKEDITOR.REMOVE_MAP }}\r\n </button>\r\n </div>\r\n <div class=\"col-4 pr-0\">\r\n <button class=\"save\" mat-flat-button (click)=\"save()\">\r\n {{ LANG.QMSCKEDITOR.SAVE }}\r\n </button>\r\n </div>\r\n <div class=\"col-4 pl-0\">\r\n <button class=\"cancel\" mat-flat-button (click)=\"cancel()\">\r\n {{ LANG.QMSCKEDITOR.CANCEL }}\r\n </button>\r\n </div>\r\n </div>\r\n </div>\r\n </mat-expansion-panel>\r\n </div>\r\n </div>\r\n</div>",
|
14886
|
+
styles: [".mt5{margin-top:5px!important}.mt10{margin-top:10px!important}.mt7{margin-top:7px!important}.mt15{margin-top:15px!important}.mt20{margin-top:20px!important}.mt30{margin-top:30px!important}.mt40{margin-top:40px!important}.ml2{margin-left:2px!important}.ml3{margin-left:3px!important}.ml5{margin-left:5px!important}.ml15{margin-left:15px!important}.ml10{margin-left:10px!important}.ml12{margin-left:12px!important}.ml16{margin-left:16px!important}.ml-auto{margin-left:auto!important}.ml-25{margin-left:-25px!important}.mr5{margin-right:5px!important}.mr12{margin-right:12px!important}.mr15{margin-right:15px!important}.mb5{margin-bottom:5px!important}.mb10{margin-bottom:10px!important}.mb15{margin-bottom:15px!important}.pt8{padding-top:8px!important}.pt10{padding-top:10px!important}.pt15{padding-top:15px!important}.pt16{padding-top:16px!important}.pl15{padding-left:15px!important}.pl0{padding-left:0!important}.pr0{padding-right:0!important}.pr15{padding-right:15px!important}.fs12{font-size:12px}.fs14{font-size:14px!important}.fs16{font-size:16px!important}.fs22{font-size:22px!important}.fw500{font-weight:500!important}.italic-text{font-style:italic}.display-flex{display:flex}.qmsckeditor{font-family:Roboto,Helvetica Neue,sans-serif;font-size:14px;font-weight:400}.qmsckeditor h2{font-size:20px;font-weight:400}.qmsckeditor .mat-dialog-content{padding:0}.qmsckeditor .mat-icon{color:#909497}.qmsckeditor__fullscreen{position:fixed;top:0;left:0;right:0;bottom:0;background:#fff;overflow-y:auto;max-height:100vh;overflow-x:hidden}.qmsckeditor__cursor{cursor:pointer}.qmsckeditor__notallowed{cursor:not-allowed}.qmsckeditor.button__close,.qmsckeditor.button__done{float:right;top:-24px;right:-24px;cursor:pointer}.qmsckeditor.button__done{margin-right:20px}.qmsckeditor.button__done .mat-icon{color:#28a745;font-weight:700}.qmsckeditor.button__groups button{min-height:40px;width:100%;border-radius:4px;border:1px solid #c5c5c5;font-family:Open Sans;font-weight:600;font-size:14px;letter-spacing:1px;line-height:16px}.qmsckeditor.button__groups .save{background:#f8f9f9}.qmsckeditor.button__groups .save:hover{background:#e5e7e9}.qmsckeditor.button__groups .save:disabled{cursor:not-allowed}.qmsckeditor.button__groups .cancel{background:#f8f9f9}.qmsckeditor.button__groups .cancel:hover{background:#e5e7e9}.qmsckeditor.button__groups .cancel:disabled{cursor:not-allowed}.qmsckeditor.button__groups .delete{background:#f8f9f9}.qmsckeditor.button__groups .delete:hover{background:#e5e7e9}.qmsckeditor.button__groups .delete:disabled{cursor:not-allowed}.qmsckeditor.confirm__button__groups button{min-height:36px;border-radius:4px;width:auto;border:1px solid #c5c5c5;font-family:Open Sans;font-weight:600;font-size:14px;letter-spacing:1px;line-height:16px;padding-left:15px;padding-right:15px}.qmsckeditor.confirm__button__groups .confirm{background:#f8f9f9}.qmsckeditor.confirm__button__groups .confirm:hover{background:#e5e7e9}.qmsckeditor.confirm__button__groups .cancel{background:#f8f9f9}.qmsckeditor.confirm__button__groups .cancel:hover{background:#e5e7e9}.qmsckeditor.template-content.height{min-height:420px;max-height:520px;overflow:auto}.qmsckeditor.template-content.title{margin-left:-9px}.qmsckeditor.link__content.height{min-height:400px;max-height:520px}.qmsckeditor.card{margin-bottom:10px;min-height:60px;box-shadow:none;border:1px solid #e5e5e5}.qmsckeditor.card .title{font-weight:700}.qmsckeditor.card .content{text-overflow:ellipsis;overflow:hidden;white-space:nowrap}.qmsckeditor.card .material-icons{font-size:20px}.qmsckeditor.tooltip-content.height{min-height:400px;max-height:470px;overflow:auto}.qmsckeditor.save__as__template.height{height:125px}.ck-content .page-break,.qmsckeditor__imagemap__container .mat-form-field{width:100%}.qmsckeditor__imagemap__container .qmsckeditor__imagemap__information{position:relative}.qmsckeditor__imagemap__container .qmsckeditor__imagemap__map{overflow:auto;width:800px;min-height:371px;position:relative;max-height:460px}.qmsckeditor__imagemap__container .mat-button-toggle-checked{border:1px solid #000!important}.qmsckeditor__imagemap__container .hidden{visibility:hidden}"]
|
14887
|
+
},] }
|
14888
|
+
];
|
14889
|
+
QMSCKEditorImageMapComponent.ctorParameters = function () { return [
|
14890
|
+
{ type: i0.Renderer2 },
|
14891
|
+
{ type: i0.ChangeDetectorRef },
|
14892
|
+
{ type: dialog.MatDialog },
|
14893
|
+
{ type: TranslateLibraryService },
|
14894
|
+
{ type: QMSCKEditorLinkService },
|
14895
|
+
{ type: dialog.MatDialogRef },
|
14896
|
+
{ type: QMSCKEditorImageMap, decorators: [{ type: i0.Inject, args: [dialog.MAT_DIALOG_DATA,] }] },
|
14897
|
+
{ type: icon.MatIconRegistry },
|
14898
|
+
{ type: platformBrowser.DomSanitizer }
|
14899
|
+
]; };
|
14900
|
+
QMSCKEditorImageMapComponent.propDecorators = {
|
14901
|
+
myImageRef: [{ type: i0.ViewChild, args: ['myImage',] }],
|
14902
|
+
myStatusRef: [{ type: i0.ViewChild, args: ['myStatus',] }]
|
14903
|
+
};
|
14904
|
+
|
14905
|
+
var QMSCKEditorTooltip = /** @class */ (function () {
|
14906
|
+
function QMSCKEditorTooltip() {
|
14907
|
+
this.text = '';
|
14908
|
+
this.content = '';
|
14909
|
+
}
|
14910
|
+
return QMSCKEditorTooltip;
|
14911
|
+
}());
|
14912
|
+
|
14913
|
+
var QMSCKEditorTooltipComponent = /** @class */ (function (_super) {
|
14914
|
+
__extends(QMSCKEditorTooltipComponent, _super);
|
14915
|
+
function QMSCKEditorTooltipComponent(cdr, translate, dialogRef, data) {
|
14916
|
+
var _this = _super.call(this) || this;
|
14917
|
+
_this.cdr = cdr;
|
14918
|
+
_this.translate = translate;
|
14919
|
+
_this.dialogRef = dialogRef;
|
14920
|
+
_this.data = data;
|
14921
|
+
_this.tooltipFormGroup = new forms.FormGroup({
|
14922
|
+
title: new forms.FormControl('', [forms.Validators.required]),
|
14923
|
+
content: new forms.FormControl('', [forms.Validators.required])
|
14924
|
+
});
|
14925
|
+
_this.tooltip = { text: data.text, content: data.content };
|
14926
|
+
_this.editor = data.ckEditor;
|
14927
|
+
return _this;
|
14928
|
+
}
|
14929
|
+
QMSCKEditorTooltipComponent.prototype.ngOnInit = function () {
|
14930
|
+
var _this = this;
|
14931
|
+
this.translate.getLanguageSubject$.pipe(operators.takeUntil(this.ngUnsubcribe)).subscribe(function (res) {
|
14932
|
+
if (res) {
|
14933
|
+
_this.LANG = _this.translate.getObjectLang(res);
|
14934
|
+
}
|
14935
|
+
});
|
14936
|
+
this.editorConfig = CKEditorCommonFunctions.getCKEditorConfiguration(',heading,|,fontsize,fontfamily,fontColor,fontBackgroundColor,|,bold,italic,underline,strikethrough,|,alignment,|,bulletedList,numberedList,|,outdent,indent,|,subscript,superscript,|,undo,redo,|,specialCharacters,blockQuote,insertTable,|,link,anchor,|,timestamp,|,removeformat');
|
14937
|
+
};
|
14938
|
+
QMSCKEditorTooltipComponent.prototype.ngAfterViewChecked = function () {
|
14939
|
+
this.cdr.detectChanges();
|
14940
|
+
};
|
14941
|
+
QMSCKEditorTooltipComponent.prototype.onCloseDialog = function () {
|
14942
|
+
this.dialogRef.close();
|
14943
|
+
};
|
14944
|
+
QMSCKEditorTooltipComponent.prototype.getOutputContent = function (content) {
|
14945
|
+
this.tooltip.content = content;
|
14946
|
+
};
|
14947
|
+
QMSCKEditorTooltipComponent.prototype.onChanged = function (_a) {
|
14948
|
+
var editor = _a.editor;
|
14949
|
+
this.tooltip.content = editor.getData();
|
14950
|
+
};
|
14951
|
+
QMSCKEditorTooltipComponent.prototype.onBlur = function (_a) {
|
14952
|
+
var editor = _a.editor;
|
14953
|
+
this.tooltip.content = editor.getData();
|
14954
|
+
};
|
14955
|
+
QMSCKEditorTooltipComponent.prototype.onReady = function (editor) {
|
14956
|
+
if (this.tooltip.text) {
|
14957
|
+
editor.setData(this.tooltip.text);
|
14958
|
+
}
|
14959
|
+
editor.ui.getEditableElement().parentElement.insertBefore(editor.ui.view.toolbar.element, editor.ui.getEditableElement());
|
14960
|
+
};
|
14961
|
+
QMSCKEditorTooltipComponent.prototype.saveTooltip = function () {
|
14962
|
+
var tooltip = new QMSCKEditorTooltip();
|
14963
|
+
tooltip.content = this.tooltip.content;
|
14964
|
+
tooltip.text = this.tooltip.text;
|
14965
|
+
this.dialogRef.close(tooltip);
|
14966
|
+
};
|
14967
|
+
QMSCKEditorTooltipComponent.prototype.cancelTooltip = function () {
|
14968
|
+
this.dialogRef.close();
|
14969
|
+
};
|
14970
|
+
return QMSCKEditorTooltipComponent;
|
14971
|
+
}(QMSCKEditorBaseComponent));
|
14972
|
+
QMSCKEditorTooltipComponent.decorators = [
|
14973
|
+
{ type: i0.Component, args: [{
|
14974
|
+
selector: 'app-qmsck-tooltip',
|
14975
|
+
template: "<div\r\n id=\"qmsckeditor-tooltip\"\r\n class=\"qmsckeditor qmsckeditor__tooltip__container\"\r\n>\r\n <div id=\"qmsckeditor-tooltip-header\">\r\n <span\r\n id=\"qmsckeditor-tooltip-header_001\"\r\n mat-icon-button\r\n class=\"qmsckeditor button__close\"\r\n (click)=\"onCloseDialog()\"\r\n >\r\n <mat-icon>close</mat-icon>\r\n </span>\r\n <div id=\"qmsckeditor-tooltip-header_002\" mat-dialog-content>\r\n <h2 id=\"qmsckeditor-tooltip_002_001\">\r\n {{ LANG.QMSCKEDITOR.INSERT_TOOLTIP }}\r\n </h2>\r\n </div>\r\n </div>\r\n <form [formGroup]=\"tooltipFormGroup\">\r\n <div\r\n id=\"qmsckeditor-tooltip-content\"\r\n class=\"qmsckeditor tooltip-content height\"\r\n >\r\n <div id=\"qmsckeditor-tooltip-content_001\" class=\"col-12 mt-1 pl-2 pr-2\">\r\n <mat-expansion-panel\r\n id=\"qmsckeditor-tooltip-panel\"\r\n [expanded]=\"true\"\r\n (opened)=\"(true)\"\r\n (closed)=\"(false)\"\r\n >\r\n <div id=\"qmsckeditor-tooltip-panel_001\">\r\n <div id=\"qmsckeditor-tooltip-panel_001_001\">\r\n <mat-form-field class=\"col-12 pl-0 pr-0\" appearance=\"fill\">\r\n <mat-label>{{ LANG.QMSCKEDITOR.TITLE }}</mat-label>\r\n <input\r\n matInput\r\n [(ngModel)]=\"tooltip.text\"\r\n formControlName=\"title\"\r\n />\r\n </mat-form-field>\r\n </div>\r\n <div id=\"qmsckeditor-tooltip-panel_001_002\">\r\n <mat-label>{{ LANG.QMSCKEDITOR.CONTENT }}</mat-label>\r\n <div class=\"qmsckeditor_container col-12 pl-0 pr-0\">\r\n <ckeditor\r\n class=\"qms-ckeditor\"\r\n [(editor)]=\"editor\"\r\n [config]=\"editorConfig\"\r\n (ready)=\"onReady($event)\"\r\n [(ngModel)]=\"tooltip.content\"\r\n (change)=\"onChanged($event)\"\r\n (blur)=\"onBlur($event)\"\r\n formControlName=\"content\"\r\n >\r\n </ckeditor>\r\n </div>\r\n </div>\r\n <div\r\n id=\"qmsckeditor-tooltip-panel_001_003\"\r\n class=\"qmsckeditor button__groups row mr-0 ml-0 mt-4\"\r\n >\r\n <div class=\"col-6 pr-0\">\r\n <button\r\n class=\"save\"\r\n mat-flat-button\r\n (click)=\"saveTooltip()\"\r\n [disabled]=\"tooltipFormGroup.invalid\"\r\n >\r\n {{ LANG.QMSCKEDITOR.SAVE }}\r\n </button>\r\n </div>\r\n <div class=\"col-6 pl-0\">\r\n <button\r\n class=\"cancel\"\r\n mat-flat-button\r\n (click)=\"cancelTooltip()\"\r\n >\r\n {{ LANG.QMSCKEDITOR.CANCEL }}\r\n </button>\r\n </div>\r\n </div>\r\n </div>\r\n </mat-expansion-panel>\r\n </div>\r\n </div>\r\n </form>\r\n</div>\r\n",
|
14976
|
+
styles: [".mt5{margin-top:5px!important}.mt10{margin-top:10px!important}.mt7{margin-top:7px!important}.mt15{margin-top:15px!important}.mt20{margin-top:20px!important}.mt30{margin-top:30px!important}.mt40{margin-top:40px!important}.ml2{margin-left:2px!important}.ml3{margin-left:3px!important}.ml5{margin-left:5px!important}.ml15{margin-left:15px!important}.ml10{margin-left:10px!important}.ml12{margin-left:12px!important}.ml16{margin-left:16px!important}.ml-auto{margin-left:auto!important}.ml-25{margin-left:-25px!important}.mr5{margin-right:5px!important}.mr12{margin-right:12px!important}.mr15{margin-right:15px!important}.mb5{margin-bottom:5px!important}.mb10{margin-bottom:10px!important}.mb15{margin-bottom:15px!important}.pt8{padding-top:8px!important}.pt10{padding-top:10px!important}.pt15{padding-top:15px!important}.pt16{padding-top:16px!important}.pl15{padding-left:15px!important}.pl0{padding-left:0!important}.pr0{padding-right:0!important}.pr15{padding-right:15px!important}.fs12{font-size:12px}.fs14{font-size:14px!important}.fs16{font-size:16px!important}.fs22{font-size:22px!important}.fw500{font-weight:500!important}.italic-text{font-style:italic}.display-flex{display:flex}.qmsckeditor{font-family:Roboto,Helvetica Neue,sans-serif;font-size:14px;font-weight:400}.qmsckeditor h2{font-size:20px;font-weight:400}.qmsckeditor .mat-dialog-content{padding:0}.qmsckeditor .mat-icon{color:#909497}.qmsckeditor__fullscreen{position:fixed;top:0;left:0;right:0;bottom:0;background:#fff;overflow-y:auto;max-height:100vh;overflow-x:hidden}.qmsckeditor__cursor{cursor:pointer}.qmsckeditor__notallowed{cursor:not-allowed}.qmsckeditor.button__close,.qmsckeditor.button__done{float:right;top:-24px;right:-24px;cursor:pointer}.qmsckeditor.button__done{margin-right:20px}.qmsckeditor.button__done .mat-icon{color:#28a745;font-weight:700}.qmsckeditor.button__groups button{min-height:40px;width:100%;border-radius:4px;border:1px solid #c5c5c5;font-family:Open Sans;font-weight:600;font-size:14px;letter-spacing:1px;line-height:16px}.qmsckeditor.button__groups .save{background:#f8f9f9}.qmsckeditor.button__groups .save:hover{background:#e5e7e9}.qmsckeditor.button__groups .save:disabled{cursor:not-allowed}.qmsckeditor.button__groups .cancel{background:#f8f9f9}.qmsckeditor.button__groups .cancel:hover{background:#e5e7e9}.qmsckeditor.button__groups .cancel:disabled{cursor:not-allowed}.qmsckeditor.button__groups .delete{background:#f8f9f9}.qmsckeditor.button__groups .delete:hover{background:#e5e7e9}.qmsckeditor.button__groups .delete:disabled{cursor:not-allowed}.qmsckeditor.confirm__button__groups button{min-height:36px;border-radius:4px;width:auto;border:1px solid #c5c5c5;font-family:Open Sans;font-weight:600;font-size:14px;letter-spacing:1px;line-height:16px;padding-left:15px;padding-right:15px}.qmsckeditor.confirm__button__groups .confirm{background:#f8f9f9}.qmsckeditor.confirm__button__groups .confirm:hover{background:#e5e7e9}.qmsckeditor.confirm__button__groups .cancel{background:#f8f9f9}.qmsckeditor.confirm__button__groups .cancel:hover{background:#e5e7e9}.qmsckeditor.template-content.height{min-height:420px;max-height:520px;overflow:auto}.qmsckeditor.template-content.title{margin-left:-9px}.qmsckeditor.link__content.height{min-height:400px;max-height:520px}.qmsckeditor.card{margin-bottom:10px;min-height:60px;box-shadow:none;border:1px solid #e5e5e5}.qmsckeditor.card .title{font-weight:700}.qmsckeditor.card .content{text-overflow:ellipsis;overflow:hidden;white-space:nowrap}.qmsckeditor.card .material-icons{font-size:20px}.qmsckeditor.tooltip-content.height{min-height:400px;max-height:470px;overflow:auto}.qmsckeditor.save__as__template.height{height:125px}.ck-content .page-break,.qmsckeditor__tooltip__container .mat-form-field{width:100%}.qmsckeditor__tooltip__container textarea.mat-input-element{min-height:150px}"]
|
14977
|
+
},] }
|
14978
|
+
];
|
14979
|
+
QMSCKEditorTooltipComponent.ctorParameters = function () { return [
|
14980
|
+
{ type: i0.ChangeDetectorRef },
|
14981
|
+
{ type: TranslateLibraryService },
|
14982
|
+
{ type: dialog.MatDialogRef },
|
14983
|
+
{ type: QMSCKEditorTooltip, decorators: [{ type: i0.Inject, args: [dialog.MAT_DIALOG_DATA,] }] }
|
14984
|
+
]; };
|
14985
|
+
|
14986
|
+
var QMSCKEditorComponent = /** @class */ (function (_super) {
|
14987
|
+
__extends(QMSCKEditorComponent, _super);
|
14988
|
+
/**
|
14989
|
+
* Constructor
|
14990
|
+
*/
|
14991
|
+
function QMSCKEditorComponent(dialog, globalService, qmsCKEditorFullscreenComponent, renderer, elRef) {
|
14992
|
+
var _this = _super.call(this) || this;
|
14993
|
+
_this.dialog = dialog;
|
14994
|
+
_this.globalService = globalService;
|
14995
|
+
_this.qmsCKEditorFullscreenComponent = qmsCKEditorFullscreenComponent;
|
14996
|
+
_this.renderer = renderer;
|
14997
|
+
_this.elRef = elRef;
|
14998
|
+
_this.required = false;
|
14999
|
+
_this.qmsckContentOutput = new i0.EventEmitter();
|
15000
|
+
_this.ckEditorEventConst = CKEditorEventConst;
|
15001
|
+
return _this;
|
15002
|
+
}
|
15003
|
+
QMSCKEditorComponent.prototype.onMessage = function (event) {
|
15004
|
+
switch (event.data.eventName) {
|
15005
|
+
case this.ckEditorEventConst.QMSCK_FULLSCREEN_PLUGIN_MSG:
|
15006
|
+
this.fullscreenEventHandling();
|
15007
|
+
break;
|
15008
|
+
case this.ckEditorEventConst.QMSCK_TEMPLATE_PLUGIN_MSG:
|
15009
|
+
this.templateEventHandling();
|
15010
|
+
break;
|
15011
|
+
case this.ckEditorEventConst.QMSCK_LOAD_TEMPLATE_PLUGIN_MSG:
|
15012
|
+
this.loadTemplateEventHandling();
|
15013
|
+
break;
|
15014
|
+
case this.ckEditorEventConst.QMSCK_LINK_PLUGIN_MSG:
|
15015
|
+
this.linkEventHandling(event.data.value);
|
15016
|
+
break;
|
15017
|
+
case this.ckEditorEventConst.QMSCK_TOOLTIP_PLUGIN_MSG:
|
15018
|
+
this.tooltipEventHandling(event.data.value);
|
15019
|
+
break;
|
15020
|
+
case this.ckEditorEventConst.QMSCK_IMAGEMAP_PLUGIN_MSG:
|
15021
|
+
this.imageMapEventHandling(event.data.value);
|
15022
|
+
break;
|
15023
|
+
case this.ckEditorEventConst.QMSCK_BPMN_PLUGIN_MSG:
|
15024
|
+
this.bpmnEventHandling(event.data.value);
|
15025
|
+
break;
|
15026
|
+
default:
|
15027
|
+
break;
|
15028
|
+
}
|
15029
|
+
};
|
15030
|
+
QMSCKEditorComponent.prototype.ngOnInit = function () {
|
15031
|
+
this.name = 'CKEditor custom build';
|
15032
|
+
this.ckEditor = this.qmsckPlugin.pluginObject;
|
15033
|
+
this.ckeditorConfig = CKEditorCommonFunctions.getCKEditorConfiguration(this.qmsckPlugin.itemToolbar);
|
15034
|
+
this.globalService.setApiUrl(this.qmsckData.apiUrl);
|
15035
|
+
if (this.isEnabledCustomizingMathtypeService()) {
|
15036
|
+
this.customizeMathTypeService();
|
15037
|
+
}
|
15038
|
+
if (this.isEnabledCustomizingTimestampFormat()) {
|
15039
|
+
this.customizeTimestampFormat();
|
15040
|
+
}
|
15041
|
+
};
|
15042
|
+
QMSCKEditorComponent.prototype.registerOnChange = function (fn) {
|
15043
|
+
this.onChange = fn;
|
15044
|
+
};
|
15045
|
+
QMSCKEditorComponent.prototype.registerOnTouched = function (fn) {
|
15046
|
+
this.onTouched = fn;
|
15047
|
+
};
|
15048
|
+
QMSCKEditorComponent.prototype.ngAfterViewInit = function () {
|
15049
|
+
if (this.isDisabled) {
|
15050
|
+
this.renderer.addClass(this.elRef.nativeElement, 'ck-disabled');
|
15051
|
+
}
|
15052
|
+
};
|
15053
|
+
QMSCKEditorComponent.prototype.isEnabledCustomizingTimestampFormat = function () {
|
15054
|
+
var pattern = /(timestamp)/gmi;
|
15055
|
+
return !!this.qmsckData.timestampFormat
|
15056
|
+
&& this.qmsckData.timestampFormat !== ''
|
15057
|
+
&& !!this.qmsckPlugin.itemToolbar
|
15058
|
+
&& this.qmsckPlugin.itemToolbar.search(pattern) > -1;
|
15059
|
+
};
|
15060
|
+
QMSCKEditorComponent.prototype.customizeTimestampFormat = function () {
|
15061
|
+
var timestampConfig = {
|
15062
|
+
timestampConfig: {
|
15063
|
+
datetimeFormat: this.qmsckData.timestampFormat
|
15064
|
+
}
|
15065
|
+
};
|
15066
|
+
this.ckEditor.defaultConfig = Object.assign(this.ckEditor.defaultConfig || {}, timestampConfig);
|
15067
|
+
};
|
15068
|
+
QMSCKEditorComponent.prototype.isEnabledCustomizingMathtypeService = function () {
|
15069
|
+
var pattern = /(MathType)|(ChemType)/gmi;
|
15070
|
+
return !!this.qmsckData.mathtypeServiceUrl
|
15071
|
+
&& this.qmsckData.mathtypeServiceUrl !== ''
|
15072
|
+
&& !!this.qmsckPlugin.itemToolbar
|
15073
|
+
&& this.qmsckPlugin.itemToolbar.search(pattern) > -1;
|
15074
|
+
};
|
15075
|
+
QMSCKEditorComponent.prototype.customizeMathTypeService = function () {
|
15076
|
+
var mathTypeConfig = {
|
15077
|
+
mathTypeParameters: {
|
15078
|
+
serviceProviderProperties: {
|
15079
|
+
URI: this.qmsckData.mathtypeServiceUrl,
|
15080
|
+
server: 'aspx'
|
15081
|
+
}
|
15082
|
+
}
|
15083
|
+
};
|
15084
|
+
this.ckEditor.defaultConfig = Object.assign(this.ckEditor.defaultConfig || {}, mathTypeConfig);
|
15085
|
+
};
|
15086
|
+
QMSCKEditorComponent.prototype.onChanged = function (_a) {
|
15087
|
+
var editor = _a.editor;
|
15088
|
+
this.qmsckContentOutput.emit(this.qmsckContentInput);
|
15089
|
+
};
|
15090
|
+
QMSCKEditorComponent.prototype.onBlur = function (_a) {
|
15091
|
+
var editor = _a.editor;
|
15092
|
+
this.qmsckContentOutput.emit(this.qmsckContentInput);
|
15093
|
+
};
|
15094
|
+
QMSCKEditorComponent.prototype.validate = function (c) {
|
15095
|
+
if (!this.required) {
|
15096
|
+
return null;
|
15097
|
+
}
|
15098
|
+
return (this.qmsckContentInput && !this.required) ? null : {
|
15099
|
+
type: {
|
15100
|
+
valid: false,
|
15101
|
+
actual: c.value
|
15102
|
+
}
|
15103
|
+
};
|
15104
|
+
};
|
15105
|
+
/**
|
15106
|
+
* onReady
|
15107
|
+
*/
|
15108
|
+
QMSCKEditorComponent.prototype.onReady = function (editor) {
|
15109
|
+
this.editorInstance = editor;
|
15110
|
+
if (this.qmsckContentInput) {
|
15111
|
+
editor.setData(this.qmsckContentInput);
|
15112
|
+
}
|
15113
|
+
this.initEditor(editor);
|
15114
|
+
};
|
15115
|
+
QMSCKEditorComponent.prototype.initEditor = function (editor) {
|
15116
|
+
editor.ui
|
15117
|
+
.getEditableElement()
|
15118
|
+
.parentElement.insertBefore(editor.ui.view.toolbar.element, editor.ui.getEditableElement());
|
15119
|
+
editor.plugins.get('FileRepository').createUploadAdapter = function (loader) {
|
15120
|
+
return new UploadAdapter(loader);
|
15121
|
+
};
|
15122
|
+
// Apped Wordcount to CKeditor
|
15123
|
+
editor.plugins.get('WordCount').on('update', function (evt, stats) {
|
15124
|
+
// Prints the current content statistics.
|
15125
|
+
var wordsBox = document.querySelector('.wordcount-content');
|
15126
|
+
wordsBox.textContent = "Words: " + stats.words + " / Characters: " + stats.characters;
|
15127
|
+
});
|
15128
|
+
};
|
15129
|
+
/**
|
15130
|
+
* Full screen - Restore down
|
15131
|
+
*/
|
15132
|
+
QMSCKEditorComponent.prototype.fullscreenEventHandling = function () {
|
15133
|
+
var ck = window.document.getElementById('qmsckeditor');
|
15134
|
+
if (ck) {
|
15135
|
+
if (!ck.classList.contains('qmsckeditor__fullscreen')) {
|
15136
|
+
this.qmsCKEditorFullscreenComponent.showFullScreen();
|
15137
|
+
}
|
15138
|
+
else {
|
15139
|
+
this.qmsCKEditorFullscreenComponent.hideFullScreen();
|
15140
|
+
}
|
15141
|
+
}
|
12580
15142
|
};
|
12581
15143
|
/**
|
12582
15144
|
* Add template - Load template
|
@@ -12680,8 +15242,39 @@
|
|
12680
15242
|
});
|
12681
15243
|
};
|
12682
15244
|
/**
|
12683
|
-
|
12684
|
-
|
15245
|
+
* ImageMap mapping
|
15246
|
+
*/
|
15247
|
+
QMSCKEditorComponent.prototype.imageMapEventHandling = function (value) {
|
15248
|
+
var _this = this;
|
15249
|
+
var data = new QMSCKEditorImageMap();
|
15250
|
+
data.name = value.name;
|
15251
|
+
data.areas = value.areas;
|
15252
|
+
data.imageUrl = value.imageUrl;
|
15253
|
+
data.imageWidth = value.imageWidth;
|
15254
|
+
data.imageHeight = value.imageHeight;
|
15255
|
+
data.module = this.qmsckData.module;
|
15256
|
+
data.entityId = this.qmsckData.entityId;
|
15257
|
+
data.editorContent = this.qmsckContentInput;
|
15258
|
+
data.linkJavaScriptLinksAllowed = this.qmsckData.linkJavaScriptLinksAllowed;
|
15259
|
+
var dialogTemplate = this.dialog.open(QMSCKEditorImageMapComponent, {
|
15260
|
+
data: data,
|
15261
|
+
disableClose: true
|
15262
|
+
});
|
15263
|
+
dialogTemplate
|
15264
|
+
.afterClosed()
|
15265
|
+
.pipe(operators.takeUntil(this.ngUnsubcribe))
|
15266
|
+
.subscribe(function (result) {
|
15267
|
+
if (result) {
|
15268
|
+
var evt = new CustomEvent(_this.ckEditorEventConst.QMSCK_IMAGEMAP_PLUGIN_RESP, {
|
15269
|
+
detail: result
|
15270
|
+
});
|
15271
|
+
window.dispatchEvent(evt);
|
15272
|
+
}
|
15273
|
+
});
|
15274
|
+
};
|
15275
|
+
/*
|
15276
|
+
Business Process Model and Notation
|
15277
|
+
*/
|
12685
15278
|
QMSCKEditorComponent.prototype.bpmnEventHandling = function (id) {
|
12686
15279
|
var _this = this;
|
12687
15280
|
var dialogTemplate = this.dialog.open(QMSCKEditorBpmnComponent, {
|
@@ -12697,12 +15290,10 @@
|
|
12697
15290
|
.pipe(operators.takeUntil(this.ngUnsubcribe))
|
12698
15291
|
.subscribe(function (result) {
|
12699
15292
|
if (result) {
|
12700
|
-
|
12701
|
-
|
12702
|
-
|
12703
|
-
|
12704
|
-
window.dispatchEvent(evt);
|
12705
|
-
}
|
15293
|
+
var evt = new CustomEvent(_this.ckEditorEventConst.QMSCK_BPMN_PLUGIN_RESP, {
|
15294
|
+
detail: result
|
15295
|
+
});
|
15296
|
+
window.dispatchEvent(evt);
|
12706
15297
|
}
|
12707
15298
|
});
|
12708
15299
|
};
|
@@ -12767,6 +15358,7 @@
|
|
12767
15358
|
QMSCKEditorRelatedComponent,
|
12768
15359
|
LinkAttachmentComponent,
|
12769
15360
|
QMSCKEditorTooltipComponent,
|
15361
|
+
QMSCKEditorImageMapComponent,
|
12770
15362
|
QMSCKEditorBpmnComponent,
|
12771
15363
|
SaveTemplateComponent
|
12772
15364
|
],
|
@@ -12786,6 +15378,10 @@
|
|
12786
15378
|
snackBar.MatSnackBarModule,
|
12787
15379
|
select.MatSelectModule,
|
12788
15380
|
button.MatButtonModule,
|
15381
|
+
buttonToggle.MatButtonToggleModule,
|
15382
|
+
progressSpinner.MatProgressSpinnerModule,
|
15383
|
+
tooltip.MatTooltipModule,
|
15384
|
+
radio.MatRadioModule,
|
12789
15385
|
tree$1.MatTreeModule,
|
12790
15386
|
autocomplete.MatAutocompleteModule,
|
12791
15387
|
scrolling.ScrollingModule,
|
@@ -12811,12 +15407,6 @@
|
|
12811
15407
|
|
12812
15408
|
var QMSCKEdtiorInputData = /** @class */ (function () {
|
12813
15409
|
function QMSCKEdtiorInputData() {
|
12814
|
-
this.apiUrl = '';
|
12815
|
-
this.module = 0;
|
12816
|
-
this.entityId = '';
|
12817
|
-
this.documentId = 0;
|
12818
|
-
this.mathtypeServiceUrl = '';
|
12819
|
-
this.timestampFormat = '';
|
12820
15410
|
}
|
12821
15411
|
return QMSCKEdtiorInputData;
|
12822
15412
|
}());
|
@@ -13573,6 +16163,8 @@
|
|
13573
16163
|
exports.ɵd = LinkAttachmentComponent;
|
13574
16164
|
exports.ɵe = QMSCKEditorTooltipComponent;
|
13575
16165
|
exports.ɵf = QMSCKEditorTooltip;
|
16166
|
+
exports.ɵg = QMSCKEditorImageMapComponent;
|
16167
|
+
exports.ɵh = QMSCKEditorImageMap;
|
13576
16168
|
|
13577
16169
|
Object.defineProperty(exports, '__esModule', { value: true });
|
13578
16170
|
|