el-text-editor 0.0.45 → 0.0.47
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/esm2020/lib/el-text-editor.component.mjs +69 -10
- package/fesm2015/el-text-editor.mjs +68 -9
- package/fesm2015/el-text-editor.mjs.map +1 -1
- package/fesm2020/el-text-editor.mjs +68 -9
- package/fesm2020/el-text-editor.mjs.map +1 -1
- package/lib/el-text-editor.component.d.ts +3 -1
- package/package.json +1 -1
@@ -88,6 +88,31 @@ class ElTextEditorComponent {
|
|
88
88
|
this.isOpen.emit(this.IsOpen);
|
89
89
|
}
|
90
90
|
};
|
91
|
+
// openColorPicker(inputId: string) {
|
92
|
+
// const inputElement = document.getElementById(inputId);
|
93
|
+
// if (inputElement) {
|
94
|
+
// inputElement.click();
|
95
|
+
// }
|
96
|
+
// }
|
97
|
+
// setTextColor(event: any) {
|
98
|
+
// const editor = document.getElementById('editor');
|
99
|
+
// if (editor) {
|
100
|
+
// editor.focus();
|
101
|
+
// const color = event.target.value;
|
102
|
+
// this.selectedTextColor = color;
|
103
|
+
// document.execCommand('foreColor', false, color);
|
104
|
+
// }
|
105
|
+
// }
|
106
|
+
// setBackgroundColor(event: any) {
|
107
|
+
// const editor = document.getElementById('editor');
|
108
|
+
// if (editor) {
|
109
|
+
// editor.focus();
|
110
|
+
// const color = event.target.value;
|
111
|
+
// this.backgroundColor = color;
|
112
|
+
// document.execCommand('hiliteColor', false, color);
|
113
|
+
// }
|
114
|
+
// }
|
115
|
+
this.savedSelection = null;
|
91
116
|
this.getUserRoles();
|
92
117
|
}
|
93
118
|
themeMode() {
|
@@ -1054,25 +1079,56 @@ class ElTextEditorComponent {
|
|
1054
1079
|
openColorPicker(inputId) {
|
1055
1080
|
const inputElement = document.getElementById(inputId);
|
1056
1081
|
if (inputElement) {
|
1082
|
+
// Save the current selection
|
1083
|
+
const selection = window.getSelection();
|
1084
|
+
if (selection && selection.rangeCount > 0) {
|
1085
|
+
this.savedSelection = selection.getRangeAt(0);
|
1086
|
+
}
|
1057
1087
|
inputElement.click();
|
1058
1088
|
}
|
1059
1089
|
}
|
1060
1090
|
setTextColor(event) {
|
1061
|
-
|
1062
|
-
if (editor) {
|
1063
|
-
editor.focus();
|
1091
|
+
if (this.savedSelection) {
|
1064
1092
|
const color = event.target.value;
|
1065
1093
|
this.selectedTextColor = color;
|
1066
|
-
|
1094
|
+
// Restore the saved selection
|
1095
|
+
const selection = window.getSelection();
|
1096
|
+
if (selection) {
|
1097
|
+
selection.removeAllRanges();
|
1098
|
+
selection.addRange(this.savedSelection);
|
1099
|
+
// Apply the color using a span
|
1100
|
+
const range = this.savedSelection;
|
1101
|
+
const span = document.createElement('span');
|
1102
|
+
span.style.color = color;
|
1103
|
+
span.textContent = range.toString();
|
1104
|
+
// Replace the selected text with the styled span
|
1105
|
+
range.deleteContents();
|
1106
|
+
range.insertNode(span);
|
1107
|
+
// Clear the saved selection
|
1108
|
+
this.savedSelection = null;
|
1109
|
+
}
|
1067
1110
|
}
|
1068
1111
|
}
|
1069
1112
|
setBackgroundColor(event) {
|
1070
|
-
|
1071
|
-
if (editor) {
|
1072
|
-
editor.focus();
|
1113
|
+
if (this.savedSelection) {
|
1073
1114
|
const color = event.target.value;
|
1074
1115
|
this.backgroundColor = color;
|
1075
|
-
|
1116
|
+
// Restore the saved selection
|
1117
|
+
const selection = window.getSelection();
|
1118
|
+
if (selection) {
|
1119
|
+
selection.removeAllRanges();
|
1120
|
+
selection.addRange(this.savedSelection);
|
1121
|
+
// Apply the background color using a span
|
1122
|
+
const range = this.savedSelection;
|
1123
|
+
const span = document.createElement('span');
|
1124
|
+
span.style.backgroundColor = color;
|
1125
|
+
span.textContent = range.toString();
|
1126
|
+
// Replace the selected text with the styled span
|
1127
|
+
range.deleteContents();
|
1128
|
+
range.insertNode(span);
|
1129
|
+
// Clear the saved selection
|
1130
|
+
this.savedSelection = null;
|
1131
|
+
}
|
1076
1132
|
}
|
1077
1133
|
}
|
1078
1134
|
// colorChanged(event: any) {
|
@@ -1096,6 +1152,7 @@ class ElTextEditorComponent {
|
|
1096
1152
|
const compressedData2 = compress(JSON.stringify(this.sanitizedContent));
|
1097
1153
|
sessionStorage.setItem('textEditor', compressedData2);
|
1098
1154
|
// alert('go to editor!')
|
1155
|
+
this.imageEdit.emit();
|
1099
1156
|
this.navigateToIMGEditor(data);
|
1100
1157
|
break;
|
1101
1158
|
case 'create-document':
|
@@ -1336,7 +1393,7 @@ class ElTextEditorComponent {
|
|
1336
1393
|
}
|
1337
1394
|
}
|
1338
1395
|
ElTextEditorComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.2.4", ngImport: i0, type: ElTextEditorComponent, deps: [{ token: i1.Router }, { token: i1.ActivatedRoute }, { token: i0.Renderer2 }, { token: i2.DomSanitizer }], target: i0.ɵɵFactoryTarget.Component });
|
1339
|
-
ElTextEditorComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.2.4", type: ElTextEditorComponent, selector: "text-editor", inputs: { editorText: "editorText", editorFrom: "editorFrom", editorAction: "editorAction", UserRole: "UserRole", style: "style", disableToolbar: "disableToolbar", placeHolder: "placeHolder", reportId: "reportId", toolbarMode: "toolbarMode", value: "value" }, outputs: { editorTextChange: "editorTextChange", editorActionResponse: "editorActionResponse", editorTextClear: "editorTextClear", imageEdit: "imageEdit", placeHolderRemove: "placeHolderRemove", isOpen: "isOpen" }, providers: [{
|
1396
|
+
ElTextEditorComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.2.4", type: ElTextEditorComponent, selector: "text-editor", inputs: { editorText: "editorText", editorFrom: "editorFrom", editorAction: "editorAction", UserRole: "UserRole", style: "style", disableToolbar: "disableToolbar", placeHolder: "placeHolder", reportId: "reportId", backgroundImage: "backgroundImage", toolbarMode: "toolbarMode", value: "value" }, outputs: { editorTextChange: "editorTextChange", editorActionResponse: "editorActionResponse", editorTextClear: "editorTextClear", imageEdit: "imageEdit", placeHolderRemove: "placeHolderRemove", isOpen: "isOpen" }, providers: [{
|
1340
1397
|
provide: NG_VALUE_ACCESSOR,
|
1341
1398
|
useExisting: forwardRef(() => ElTextEditorComponent),
|
1342
1399
|
multi: true
|
@@ -1364,6 +1421,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.4", ngImpor
|
|
1364
1421
|
type: Input
|
1365
1422
|
}], reportId: [{
|
1366
1423
|
type: Input
|
1424
|
+
}], backgroundImage: [{
|
1425
|
+
type: Input
|
1367
1426
|
}], toolbarMode: [{
|
1368
1427
|
type: Input
|
1369
1428
|
}], editorTextChange: [{
|