@unicef-polymer/etools-form-builder 3.2.2 → 3.2.4
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/LICENSE +674 -674
- package/README.md +1 -1
- package/dist/form-attachments-popup/form-attachments-popup.js +135 -135
- package/dist/form-fields/abstract-field-base.class.js +100 -100
- package/dist/form-fields/field-renderer-component.js +198 -166
- package/dist/form-fields/index.d.ts +2 -0
- package/dist/form-fields/index.js +2 -0
- package/dist/form-fields/repeatable-fields/repeatable-attachment-field.js +111 -111
- package/dist/form-fields/repeatable-fields/repeatable-base-field.js +22 -22
- package/dist/form-fields/repeatable-fields/repeatable-choice-field.d.ts +15 -0
- package/dist/form-fields/repeatable-fields/repeatable-choice-field.js +123 -0
- package/dist/form-fields/repeatable-fields/repeatable-number-field.js +19 -19
- package/dist/form-fields/repeatable-fields/repeatable-scale-field.js +57 -57
- package/dist/form-fields/repeatable-fields/repeatable-text-field.js +19 -19
- package/dist/form-fields/single-fields/attachment-field.js +13 -13
- package/dist/form-fields/single-fields/boolean-field.js +16 -16
- package/dist/form-fields/single-fields/choice-field.d.ts +17 -0
- package/dist/form-fields/single-fields/choice-field.js +121 -0
- package/dist/form-fields/single-fields/number-field.js +20 -20
- package/dist/form-fields/single-fields/scale-field.js +58 -58
- package/dist/form-fields/single-fields/text-field.js +30 -30
- package/dist/form-groups/form-abstract-group.d.ts +2 -1
- package/dist/form-groups/form-abstract-group.js +130 -129
- package/dist/form-groups/form-card.js +30 -30
- package/dist/form-groups/form-collapsed-card.js +34 -34
- package/dist/lib/additional-components/confirmation-dialog.js +20 -20
- package/dist/lib/additional-components/etools-fb-card.js +144 -144
- package/dist/lib/styles/attachments.styles.js +61 -61
- package/dist/lib/styles/card-styles.js +147 -147
- package/dist/lib/styles/dialog.styles.js +83 -83
- package/dist/lib/styles/elevation-styles.js +46 -46
- package/dist/lib/styles/flex-layout-classes.js +316 -316
- package/dist/lib/styles/form-builder-card.styles.js +53 -53
- package/dist/lib/styles/page-layout-styles.js +198 -198
- package/dist/lib/styles/shared-styles.js +61 -61
- package/dist/lib/types/form-builder.types.d.ts +1 -1
- package/dist/rich-editor/rich-action.js +34 -34
- package/dist/rich-editor/rich-text.d.ts +1 -0
- package/dist/rich-editor/rich-text.js +163 -65
- package/dist/rich-editor/rich-toolbar.js +125 -125
- package/dist/rich-editor/rich-viewer.js +21 -21
- package/package.json +52 -51
|
@@ -14,16 +14,16 @@ let RichAction = class RichAction extends LitElement {
|
|
|
14
14
|
}
|
|
15
15
|
render() {
|
|
16
16
|
const hasItems = this.values.length > 0;
|
|
17
|
-
return html `<section style="color:${this.color}">
|
|
17
|
+
return html `<section style="color:${this.color}">
|
|
18
18
|
${hasItems
|
|
19
|
-
? html ` <etools-dropdown
|
|
20
|
-
option-label="name"
|
|
21
|
-
option-value="value"
|
|
22
|
-
.options="${this.values}"
|
|
23
|
-
.selected="${this.selectedValue || this.values[0].value}"
|
|
24
|
-
dynamic-align
|
|
25
|
-
hide-search
|
|
26
|
-
trigger-value-change-event
|
|
19
|
+
? html ` <etools-dropdown
|
|
20
|
+
option-label="name"
|
|
21
|
+
option-value="value"
|
|
22
|
+
.options="${this.values}"
|
|
23
|
+
.selected="${this.selectedValue || this.values[0].value}"
|
|
24
|
+
dynamic-align
|
|
25
|
+
hide-search
|
|
26
|
+
trigger-value-change-event
|
|
27
27
|
@etools-selected-item-changed="${({ detail }) => {
|
|
28
28
|
if (detail === undefined || detail.selectedItem === null) {
|
|
29
29
|
return;
|
|
@@ -35,12 +35,12 @@ let RichAction = class RichAction extends LitElement {
|
|
|
35
35
|
else {
|
|
36
36
|
editorCommand(this.command, this.selectedValue);
|
|
37
37
|
}
|
|
38
|
-
}}"
|
|
39
|
-
>
|
|
38
|
+
}}"
|
|
39
|
+
>
|
|
40
40
|
</etools-dropdown>`
|
|
41
|
-
: html `<etools-icon-button
|
|
42
|
-
?active="${this.active}"
|
|
43
|
-
name="${this.icon}"
|
|
41
|
+
: html `<etools-icon-button
|
|
42
|
+
?active="${this.active}"
|
|
43
|
+
name="${this.icon}"
|
|
44
44
|
@click=${() => {
|
|
45
45
|
if (this.command) {
|
|
46
46
|
editorCommand(this.command, this.value);
|
|
@@ -51,29 +51,29 @@ let RichAction = class RichAction extends LitElement {
|
|
|
51
51
|
composed: true
|
|
52
52
|
}));
|
|
53
53
|
}
|
|
54
|
-
}}
|
|
55
|
-
></etools-icon-button>`}
|
|
56
|
-
<div><slot></slot></div>
|
|
54
|
+
}}
|
|
55
|
+
></etools-icon-button>`}
|
|
56
|
+
<div><slot></slot></div>
|
|
57
57
|
</section>`;
|
|
58
58
|
}
|
|
59
59
|
};
|
|
60
|
-
RichAction.styles = css `
|
|
61
|
-
section {
|
|
62
|
-
height: 100%;
|
|
63
|
-
display: flex;
|
|
64
|
-
flex-direction: row;
|
|
65
|
-
flex-wrap: wrap;
|
|
66
|
-
align-items: center;
|
|
67
|
-
}
|
|
68
|
-
etools-icon-button {
|
|
69
|
-
cursor: pointer;
|
|
70
|
-
width: 12px;
|
|
71
|
-
padding: 0px 8px;
|
|
72
|
-
}
|
|
73
|
-
etools-dropdown {
|
|
74
|
-
min-width: 140px;
|
|
75
|
-
margin-block-end: 2px;
|
|
76
|
-
}
|
|
60
|
+
RichAction.styles = css `
|
|
61
|
+
section {
|
|
62
|
+
height: 100%;
|
|
63
|
+
display: flex;
|
|
64
|
+
flex-direction: row;
|
|
65
|
+
flex-wrap: wrap;
|
|
66
|
+
align-items: center;
|
|
67
|
+
}
|
|
68
|
+
etools-icon-button {
|
|
69
|
+
cursor: pointer;
|
|
70
|
+
width: 12px;
|
|
71
|
+
padding: 0px 8px;
|
|
72
|
+
}
|
|
73
|
+
etools-dropdown {
|
|
74
|
+
min-width: 140px;
|
|
75
|
+
margin-block-end: 2px;
|
|
76
|
+
}
|
|
77
77
|
`;
|
|
78
78
|
__decorate([
|
|
79
79
|
property({ type: String })
|
|
@@ -4,21 +4,113 @@ import { property, customElement } from 'lit/decorators.js';
|
|
|
4
4
|
import { fireEvent } from '../lib/utils/fire-custom-event';
|
|
5
5
|
import './rich-toolbar';
|
|
6
6
|
import './rich-viewer';
|
|
7
|
+
import DOMPurify from 'dompurify';
|
|
7
8
|
let RichText = class RichText extends LitElement {
|
|
8
9
|
constructor() {
|
|
9
10
|
super(...arguments);
|
|
10
11
|
this.selection = null;
|
|
11
12
|
this.readonly = false;
|
|
12
13
|
this.node = document.createElement('div');
|
|
14
|
+
this.clean = {
|
|
15
|
+
FORBID_TAGS: ['style', 'script'],
|
|
16
|
+
FORBID_ATTR: [
|
|
17
|
+
'class',
|
|
18
|
+
'onauxclick',
|
|
19
|
+
'onafterprint',
|
|
20
|
+
'onbeforematch',
|
|
21
|
+
'onbeforeprint',
|
|
22
|
+
'onbeforeunload',
|
|
23
|
+
'onbeforetoggle',
|
|
24
|
+
'onblur',
|
|
25
|
+
'oncancel',
|
|
26
|
+
'oncanplay',
|
|
27
|
+
'oncanplaythrough',
|
|
28
|
+
'onchange',
|
|
29
|
+
'onclick',
|
|
30
|
+
'onclose',
|
|
31
|
+
'oncontextlost',
|
|
32
|
+
'oncontextmenu',
|
|
33
|
+
'oncontextrestored',
|
|
34
|
+
'oncopy',
|
|
35
|
+
'oncuechange',
|
|
36
|
+
'oncut',
|
|
37
|
+
'ondblclick',
|
|
38
|
+
'ondrag',
|
|
39
|
+
'ondragend',
|
|
40
|
+
'ondragenter',
|
|
41
|
+
'ondragleave',
|
|
42
|
+
'ondragover',
|
|
43
|
+
'ondragstart',
|
|
44
|
+
'ondrop',
|
|
45
|
+
'ondurationchange',
|
|
46
|
+
'onemptied',
|
|
47
|
+
'onended',
|
|
48
|
+
'onerror',
|
|
49
|
+
'onfocus',
|
|
50
|
+
'onformdata',
|
|
51
|
+
'onhashchange',
|
|
52
|
+
'oninput',
|
|
53
|
+
'oninvalid',
|
|
54
|
+
'onkeydown',
|
|
55
|
+
'onkeypress',
|
|
56
|
+
'onkeyup',
|
|
57
|
+
'onlanguagechange',
|
|
58
|
+
'onload',
|
|
59
|
+
'onloadeddata',
|
|
60
|
+
'onloadedmetadata',
|
|
61
|
+
'onloadstart',
|
|
62
|
+
'onmessage',
|
|
63
|
+
'onmessageerror',
|
|
64
|
+
'onmousedown',
|
|
65
|
+
'onmouseenter',
|
|
66
|
+
'onmouseleave',
|
|
67
|
+
'onmousemove',
|
|
68
|
+
'onmouseout',
|
|
69
|
+
'onmouseover',
|
|
70
|
+
'onmouseup',
|
|
71
|
+
'onoffline',
|
|
72
|
+
'ononline',
|
|
73
|
+
'onpagehide',
|
|
74
|
+
'onpageshow',
|
|
75
|
+
'onpaste',
|
|
76
|
+
'onpause',
|
|
77
|
+
'onplay',
|
|
78
|
+
'onplaying',
|
|
79
|
+
'onpopstate',
|
|
80
|
+
'onprogress',
|
|
81
|
+
'onratechange',
|
|
82
|
+
'onreset',
|
|
83
|
+
'onresize',
|
|
84
|
+
'onrejectionhandled',
|
|
85
|
+
'onscroll',
|
|
86
|
+
'onscrollend',
|
|
87
|
+
'onsecuritypolicyviolation',
|
|
88
|
+
'onseeked',
|
|
89
|
+
'onseeking',
|
|
90
|
+
'onselect',
|
|
91
|
+
'onslotchange',
|
|
92
|
+
'onstalled',
|
|
93
|
+
'onstorage',
|
|
94
|
+
'onsubmit',
|
|
95
|
+
'onsuspend',
|
|
96
|
+
'ontimeupdate',
|
|
97
|
+
'ontoggle',
|
|
98
|
+
'onunhandledrejection',
|
|
99
|
+
'onunload',
|
|
100
|
+
'onvolumechange',
|
|
101
|
+
'onwaiting',
|
|
102
|
+
'onwheel'
|
|
103
|
+
]
|
|
104
|
+
};
|
|
13
105
|
}
|
|
14
106
|
render() {
|
|
15
107
|
const { selection, readonly, node } = this;
|
|
16
|
-
return html `<main>
|
|
17
|
-
<rich-toolbar
|
|
18
|
-
part="rich-toolbar"
|
|
19
|
-
?hidden="${this.readonly}"
|
|
20
|
-
.selection="${selection}"
|
|
21
|
-
.node="${node}"
|
|
108
|
+
return html `<main>
|
|
109
|
+
<rich-toolbar
|
|
110
|
+
part="rich-toolbar"
|
|
111
|
+
?hidden="${this.readonly}"
|
|
112
|
+
.selection="${selection}"
|
|
113
|
+
.node="${node}"
|
|
22
114
|
@set-content=${(e) => {
|
|
23
115
|
var _a;
|
|
24
116
|
const event = e;
|
|
@@ -27,20 +119,26 @@ let RichText = class RichText extends LitElement {
|
|
|
27
119
|
const root = doc.querySelector('body');
|
|
28
120
|
this.node.innerHTML = (_a = root === null || root === void 0 ? void 0 : root.innerHTML) !== null && _a !== void 0 ? _a : '';
|
|
29
121
|
this.requestUpdate();
|
|
30
|
-
}}
|
|
31
|
-
></rich-toolbar>
|
|
32
|
-
<rich-viewer
|
|
33
|
-
part="rich-viewer"
|
|
34
|
-
?readonly="${readonly}"
|
|
35
|
-
.value="${this.value}"
|
|
122
|
+
}}
|
|
123
|
+
></rich-toolbar>
|
|
124
|
+
<rich-viewer
|
|
125
|
+
part="rich-viewer"
|
|
126
|
+
?readonly="${readonly}"
|
|
127
|
+
.value="${this.value}"
|
|
36
128
|
@selection=${(e) => {
|
|
37
129
|
const event = e;
|
|
38
130
|
this.selection = event.detail.selection;
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
131
|
+
let sanitizedHTML = event.detail.html || '';
|
|
132
|
+
// remove all mso- from styling
|
|
133
|
+
sanitizedHTML = sanitizedHTML.replace(/mso-[^:]+:[^;"]+;?/gi, '');
|
|
134
|
+
// remove all comments
|
|
135
|
+
sanitizedHTML = sanitizedHTML.replace(/<!--[\s\S]*?-->/g, '');
|
|
136
|
+
sanitizedHTML = DOMPurify.sanitize(sanitizedHTML, this.clean);
|
|
137
|
+
fireEvent(this, 'editor-changed', { value: sanitizedHTML });
|
|
138
|
+
}}
|
|
139
|
+
.node="${node}"
|
|
140
|
+
>
|
|
141
|
+
</rich-viewer>
|
|
44
142
|
</main>`;
|
|
45
143
|
}
|
|
46
144
|
firstUpdated() {
|
|
@@ -58,54 +156,54 @@ let RichText = class RichText extends LitElement {
|
|
|
58
156
|
}
|
|
59
157
|
}
|
|
60
158
|
};
|
|
61
|
-
RichText.styles = css `
|
|
62
|
-
:host {
|
|
63
|
-
--rich-color: black;
|
|
64
|
-
--rich-background: white;
|
|
65
|
-
--rich-action-active-color: red;
|
|
66
|
-
--icon-size: 24px;
|
|
67
|
-
border: solid 1px var(--rich-border-color, #eeeeee);
|
|
68
|
-
background-color: #ffffff;
|
|
69
|
-
width: 100%;
|
|
70
|
-
}
|
|
71
|
-
main {
|
|
72
|
-
height: 100%;
|
|
73
|
-
width: 100%;
|
|
74
|
-
display: grid;
|
|
75
|
-
grid-template-rows: 1fr auto;
|
|
76
|
-
grid-template-columns: 1fr;
|
|
77
|
-
grid-template-areas:
|
|
78
|
-
'viewer'
|
|
79
|
-
'toolbar';
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
rich-toolbar {
|
|
83
|
-
grid-area: toolbar;
|
|
84
|
-
width: 100%;
|
|
85
|
-
background-color: var(--rich-toolbar-background, #ffffff);
|
|
86
|
-
color: var(--rich-color);
|
|
87
|
-
border-bottom: 1px solid var(--rich-toolbar-border-color, #eeeeee);
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
rich-viewer {
|
|
91
|
-
grid-area: viewer;
|
|
92
|
-
flex: 1;
|
|
93
|
-
width: 100%;
|
|
94
|
-
min-height: 40px;
|
|
95
|
-
overflow-y: auto;
|
|
96
|
-
background-color: var(--rich-background);
|
|
97
|
-
color: var(--rich-color);
|
|
98
|
-
}
|
|
99
|
-
main {
|
|
100
|
-
grid-template-rows: auto 1fr;
|
|
101
|
-
grid-template-areas:
|
|
102
|
-
'toolbar'
|
|
103
|
-
'viewer';
|
|
104
|
-
}
|
|
105
|
-
rich-toolbar {
|
|
106
|
-
border-top: none;
|
|
107
|
-
border-bottom: 1px solid var(--rich-color);
|
|
108
|
-
}
|
|
159
|
+
RichText.styles = css `
|
|
160
|
+
:host {
|
|
161
|
+
--rich-color: black;
|
|
162
|
+
--rich-background: white;
|
|
163
|
+
--rich-action-active-color: red;
|
|
164
|
+
--icon-size: 24px;
|
|
165
|
+
border: solid 1px var(--rich-border-color, #eeeeee);
|
|
166
|
+
background-color: #ffffff;
|
|
167
|
+
width: 100%;
|
|
168
|
+
}
|
|
169
|
+
main {
|
|
170
|
+
height: 100%;
|
|
171
|
+
width: 100%;
|
|
172
|
+
display: grid;
|
|
173
|
+
grid-template-rows: 1fr auto;
|
|
174
|
+
grid-template-columns: 1fr;
|
|
175
|
+
grid-template-areas:
|
|
176
|
+
'viewer'
|
|
177
|
+
'toolbar';
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
rich-toolbar {
|
|
181
|
+
grid-area: toolbar;
|
|
182
|
+
width: 100%;
|
|
183
|
+
background-color: var(--rich-toolbar-background, #ffffff);
|
|
184
|
+
color: var(--rich-color);
|
|
185
|
+
border-bottom: 1px solid var(--rich-toolbar-border-color, #eeeeee);
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
rich-viewer {
|
|
189
|
+
grid-area: viewer;
|
|
190
|
+
flex: 1;
|
|
191
|
+
width: 100%;
|
|
192
|
+
min-height: 40px;
|
|
193
|
+
overflow-y: auto;
|
|
194
|
+
background-color: var(--rich-background);
|
|
195
|
+
color: var(--rich-color);
|
|
196
|
+
}
|
|
197
|
+
main {
|
|
198
|
+
grid-template-rows: auto 1fr;
|
|
199
|
+
grid-template-areas:
|
|
200
|
+
'toolbar'
|
|
201
|
+
'viewer';
|
|
202
|
+
}
|
|
203
|
+
rich-toolbar {
|
|
204
|
+
border-top: none;
|
|
205
|
+
border-bottom: 1px solid var(--rich-color);
|
|
206
|
+
}
|
|
109
207
|
`;
|
|
110
208
|
__decorate([
|
|
111
209
|
property({ type: Object, hasChanged: () => true })
|
|
@@ -8,100 +8,100 @@ import { getTranslation } from '../lib/utils/translate';
|
|
|
8
8
|
let RichToolbar = class RichToolbar extends LitElement {
|
|
9
9
|
render() {
|
|
10
10
|
const tags = this.getTags();
|
|
11
|
-
return html `<header>
|
|
12
|
-
<rich-action icon="editor:format-bold" command="bold" ?active=${tags.includes('b')}></rich-action>
|
|
13
|
-
<rich-action icon="editor:format-italic" command="italic" ?active=${tags.includes('i')}></rich-action>
|
|
14
|
-
<rich-action icon="editor:format-underlined" command="underline" ?active=${tags.includes('u')}></rich-action>
|
|
15
|
-
<rich-action
|
|
16
|
-
icon="editor:format-align-left"
|
|
17
|
-
command="justifyleft"
|
|
18
|
-
?active=${tags.includes('text-align-left')}
|
|
19
|
-
></rich-action>
|
|
20
|
-
<rich-action
|
|
21
|
-
icon="editor:format-align-center"
|
|
22
|
-
command="justifycenter"
|
|
23
|
-
?active=${tags.includes('text-align-center')}
|
|
24
|
-
></rich-action>
|
|
25
|
-
<rich-action
|
|
26
|
-
icon="editor:format-align-right"
|
|
27
|
-
command="justifyright"
|
|
28
|
-
?active=${tags.includes('text-align-right')}
|
|
29
|
-
></rich-action>
|
|
30
|
-
<rich-action
|
|
31
|
-
icon="editor:format-list-numbered"
|
|
32
|
-
command="insertorderedlist"
|
|
33
|
-
?active=${tags.includes('ol')}
|
|
34
|
-
></rich-action>
|
|
35
|
-
<rich-action
|
|
36
|
-
icon="editor:format-list-bulleted"
|
|
37
|
-
command="insertunorderedlist"
|
|
38
|
-
?active=${tags.includes('ul')}
|
|
39
|
-
></rich-action>
|
|
40
|
-
<rich-action
|
|
41
|
-
icon="format_quote"
|
|
42
|
-
command="formatblock"
|
|
43
|
-
value="blockquote"
|
|
44
|
-
?active=${tags.includes('blockquote')}
|
|
45
|
-
></rich-action>
|
|
46
|
-
<!-- <rich-action icon="format_indent_decrease" command="outdent"></rich-action>
|
|
47
|
-
<rich-action icon="format_indent_increase" command="indent"></rich-action> -->
|
|
48
|
-
<rich-action
|
|
49
|
-
icon="editor:add-link"
|
|
50
|
-
?active=${tags.includes('a')}
|
|
11
|
+
return html `<header>
|
|
12
|
+
<rich-action icon="editor:format-bold" command="bold" ?active=${tags.includes('b')}></rich-action>
|
|
13
|
+
<rich-action icon="editor:format-italic" command="italic" ?active=${tags.includes('i')}></rich-action>
|
|
14
|
+
<rich-action icon="editor:format-underlined" command="underline" ?active=${tags.includes('u')}></rich-action>
|
|
15
|
+
<rich-action
|
|
16
|
+
icon="editor:format-align-left"
|
|
17
|
+
command="justifyleft"
|
|
18
|
+
?active=${tags.includes('text-align-left')}
|
|
19
|
+
></rich-action>
|
|
20
|
+
<rich-action
|
|
21
|
+
icon="editor:format-align-center"
|
|
22
|
+
command="justifycenter"
|
|
23
|
+
?active=${tags.includes('text-align-center')}
|
|
24
|
+
></rich-action>
|
|
25
|
+
<rich-action
|
|
26
|
+
icon="editor:format-align-right"
|
|
27
|
+
command="justifyright"
|
|
28
|
+
?active=${tags.includes('text-align-right')}
|
|
29
|
+
></rich-action>
|
|
30
|
+
<rich-action
|
|
31
|
+
icon="editor:format-list-numbered"
|
|
32
|
+
command="insertorderedlist"
|
|
33
|
+
?active=${tags.includes('ol')}
|
|
34
|
+
></rich-action>
|
|
35
|
+
<rich-action
|
|
36
|
+
icon="editor:format-list-bulleted"
|
|
37
|
+
command="insertunorderedlist"
|
|
38
|
+
?active=${tags.includes('ul')}
|
|
39
|
+
></rich-action>
|
|
40
|
+
<rich-action
|
|
41
|
+
icon="format_quote"
|
|
42
|
+
command="formatblock"
|
|
43
|
+
value="blockquote"
|
|
44
|
+
?active=${tags.includes('blockquote')}
|
|
45
|
+
></rich-action>
|
|
46
|
+
<!-- <rich-action icon="format_indent_decrease" command="outdent"></rich-action>
|
|
47
|
+
<rich-action icon="format_indent_increase" command="indent"></rich-action> -->
|
|
48
|
+
<rich-action
|
|
49
|
+
icon="editor:add-link"
|
|
50
|
+
?active=${tags.includes('a')}
|
|
51
51
|
@action=${() => {
|
|
52
52
|
const newLink = prompt('Write the URL here', 'https://');
|
|
53
53
|
// Check if valid url
|
|
54
54
|
if (newLink && newLink.match(/^(http|https):\/\/[^ "]+$/)) {
|
|
55
55
|
editorCommand('createlink', newLink);
|
|
56
56
|
}
|
|
57
|
-
}}
|
|
58
|
-
>
|
|
59
|
-
</rich-action>
|
|
60
|
-
<rich-action icon="editor:unlink" command="unlink"></rich-action>
|
|
61
|
-
<rich-action
|
|
62
|
-
icon="editor:format-color-text"
|
|
63
|
-
.color="${this.formatColor}"
|
|
64
|
-
@action=${() => editorCommand('forecolor', this.formatColor)}
|
|
65
|
-
>
|
|
66
|
-
<etools-icon-button
|
|
67
|
-
class="arrow-icon"
|
|
68
|
-
name="arrow-drop-down"
|
|
69
|
-
@click="${() => this.fgColorInput.click()}"
|
|
70
|
-
></etools-icon-button>
|
|
71
|
-
<input
|
|
72
|
-
type="color"
|
|
73
|
-
id="fg-color"
|
|
57
|
+
}}
|
|
58
|
+
>
|
|
59
|
+
</rich-action>
|
|
60
|
+
<rich-action icon="editor:unlink" command="unlink"></rich-action>
|
|
61
|
+
<rich-action
|
|
62
|
+
icon="editor:format-color-text"
|
|
63
|
+
.color="${this.formatColor}"
|
|
64
|
+
@action=${() => editorCommand('forecolor', this.formatColor)}
|
|
65
|
+
>
|
|
66
|
+
<etools-icon-button
|
|
67
|
+
class="arrow-icon"
|
|
68
|
+
name="arrow-drop-down"
|
|
69
|
+
@click="${() => this.fgColorInput.click()}"
|
|
70
|
+
></etools-icon-button>
|
|
71
|
+
<input
|
|
72
|
+
type="color"
|
|
73
|
+
id="fg-color"
|
|
74
74
|
@input=${(e) => {
|
|
75
75
|
const input = e.target;
|
|
76
76
|
this.formatColor = input.value;
|
|
77
77
|
editorCommand('forecolor', input.value);
|
|
78
|
-
}}
|
|
79
|
-
/>
|
|
80
|
-
</rich-action>
|
|
81
|
-
<rich-action
|
|
82
|
-
icon="editor:background-color"
|
|
83
|
-
.color="${this.backgroundColor}"
|
|
84
|
-
@action=${() => editorCommand('backcolor', this.backgroundColor)}
|
|
85
|
-
>
|
|
86
|
-
<etools-icon-button
|
|
87
|
-
class="arrow-icon"
|
|
88
|
-
name="arrow-drop-down"
|
|
89
|
-
@click="${() => this.bdColorInput.click()}"
|
|
90
|
-
></etools-icon-button>
|
|
91
|
-
<input
|
|
92
|
-
type="color"
|
|
93
|
-
id="bd-color"
|
|
78
|
+
}}
|
|
79
|
+
/>
|
|
80
|
+
</rich-action>
|
|
81
|
+
<rich-action
|
|
82
|
+
icon="editor:background-color"
|
|
83
|
+
.color="${this.backgroundColor}"
|
|
84
|
+
@action=${() => editorCommand('backcolor', this.backgroundColor)}
|
|
85
|
+
>
|
|
86
|
+
<etools-icon-button
|
|
87
|
+
class="arrow-icon"
|
|
88
|
+
name="arrow-drop-down"
|
|
89
|
+
@click="${() => this.bdColorInput.click()}"
|
|
90
|
+
></etools-icon-button>
|
|
91
|
+
<input
|
|
92
|
+
type="color"
|
|
93
|
+
id="bd-color"
|
|
94
94
|
@input=${(e) => {
|
|
95
95
|
const input = e.target;
|
|
96
96
|
this.backgroundColor = input.value;
|
|
97
97
|
editorCommand('backcolor', input.value);
|
|
98
|
-
}}
|
|
99
|
-
/>
|
|
100
|
-
</rich-action>
|
|
101
|
-
<rich-action
|
|
102
|
-
icon="title"
|
|
103
|
-
command="formatblock"
|
|
104
|
-
.selectedValue="${this.selectedFormatBlock}"
|
|
98
|
+
}}
|
|
99
|
+
/>
|
|
100
|
+
</rich-action>
|
|
101
|
+
<rich-action
|
|
102
|
+
icon="title"
|
|
103
|
+
command="formatblock"
|
|
104
|
+
.selectedValue="${this.selectedFormatBlock}"
|
|
105
105
|
.values=${[
|
|
106
106
|
{ name: getTranslation(this.language, 'NORMAL_TEXT'), value: '--' },
|
|
107
107
|
{ name: getTranslation(this.language, 'HEADING1'), value: 'h1' },
|
|
@@ -110,12 +110,12 @@ let RichToolbar = class RichToolbar extends LitElement {
|
|
|
110
110
|
{ name: getTranslation(this.language, 'HEADING4'), value: 'h4' },
|
|
111
111
|
{ name: getTranslation(this.language, 'PARAGRAPH'), value: 'p' },
|
|
112
112
|
{ name: getTranslation(this.language, 'PRE_FORMATTED'), value: 'pre' }
|
|
113
|
-
]}
|
|
114
|
-
></rich-action>
|
|
115
|
-
<rich-action
|
|
116
|
-
icon="editor:format-size"
|
|
117
|
-
command="fontsize"
|
|
118
|
-
.selectedValue="${this.selectedFontSize}"
|
|
113
|
+
]}
|
|
114
|
+
></rich-action>
|
|
115
|
+
<rich-action
|
|
116
|
+
icon="editor:format-size"
|
|
117
|
+
command="fontsize"
|
|
118
|
+
.selectedValue="${this.selectedFontSize}"
|
|
119
119
|
.values=${[
|
|
120
120
|
{ name: getTranslation(this.language, 'FONT_SIZE'), value: '--' },
|
|
121
121
|
{ name: getTranslation(this.language, 'VERY_SMALL'), value: '1' },
|
|
@@ -123,14 +123,14 @@ let RichToolbar = class RichToolbar extends LitElement {
|
|
|
123
123
|
{ name: getTranslation(this.language, 'NORMAL'), value: '3' },
|
|
124
124
|
{ name: getTranslation(this.language, 'MEDIUM_LARGE'), value: '4' },
|
|
125
125
|
{ name: getTranslation(this.language, 'LARGE'), value: '5' }
|
|
126
|
-
]}
|
|
127
|
-
></rich-action>
|
|
128
|
-
<rich-action icon="undo" command="undo"></rich-action>
|
|
129
|
-
<rich-action icon="redo" command="redo"></rich-action>
|
|
130
|
-
<rich-action icon="editor:format-clear" command="removeFormat"></rich-action>
|
|
131
|
-
<!-- <rich-action icon="content_cut" command="cut"></rich-action> -->
|
|
132
|
-
<!-- <rich-action icon="content_copy" command="copy"></rich-action>
|
|
133
|
-
<rich-action icon="content_paste" command="paste"></rich-action> -->
|
|
126
|
+
]}
|
|
127
|
+
></rich-action>
|
|
128
|
+
<rich-action icon="undo" command="undo"></rich-action>
|
|
129
|
+
<rich-action icon="redo" command="redo"></rich-action>
|
|
130
|
+
<rich-action icon="editor:format-clear" command="removeFormat"></rich-action>
|
|
131
|
+
<!-- <rich-action icon="content_cut" command="cut"></rich-action> -->
|
|
132
|
+
<!-- <rich-action icon="content_copy" command="copy"></rich-action>
|
|
133
|
+
<rich-action icon="content_paste" command="paste"></rich-action> -->
|
|
134
134
|
</header>`;
|
|
135
135
|
}
|
|
136
136
|
constructor() {
|
|
@@ -217,37 +217,37 @@ let RichToolbar = class RichToolbar extends LitElement {
|
|
|
217
217
|
return tags;
|
|
218
218
|
}
|
|
219
219
|
};
|
|
220
|
-
RichToolbar.styles = css `
|
|
221
|
-
header {
|
|
222
|
-
width: 100%;
|
|
223
|
-
display: flex;
|
|
224
|
-
flex-direction: row;
|
|
225
|
-
align-items: flex-end;
|
|
226
|
-
justify-content: flex-start;
|
|
227
|
-
padding-inline-start: 12px;
|
|
228
|
-
flex-wrap: wrap;
|
|
229
|
-
}
|
|
230
|
-
input[type='color'] {
|
|
231
|
-
-webkit-appearance: none;
|
|
232
|
-
border: none;
|
|
233
|
-
width: 0;
|
|
234
|
-
height: 0;
|
|
235
|
-
}
|
|
236
|
-
input[type='color']::-webkit-color-swatch-wrapper {
|
|
237
|
-
padding: 0;
|
|
238
|
-
}
|
|
239
|
-
input[type='color']::-webkit-color-swatch {
|
|
240
|
-
border: none;
|
|
241
|
-
}
|
|
242
|
-
rich-action {
|
|
243
|
-
margin: 2px 4px 2px 2px;
|
|
244
|
-
}
|
|
245
|
-
rich-action[active] {
|
|
246
|
-
background-color: #e8e8e8;
|
|
247
|
-
}
|
|
248
|
-
.arrow-icon {
|
|
249
|
-
margin-left: -6px;
|
|
250
|
-
}
|
|
220
|
+
RichToolbar.styles = css `
|
|
221
|
+
header {
|
|
222
|
+
width: 100%;
|
|
223
|
+
display: flex;
|
|
224
|
+
flex-direction: row;
|
|
225
|
+
align-items: flex-end;
|
|
226
|
+
justify-content: flex-start;
|
|
227
|
+
padding-inline-start: 12px;
|
|
228
|
+
flex-wrap: wrap;
|
|
229
|
+
}
|
|
230
|
+
input[type='color'] {
|
|
231
|
+
-webkit-appearance: none;
|
|
232
|
+
border: none;
|
|
233
|
+
width: 0;
|
|
234
|
+
height: 0;
|
|
235
|
+
}
|
|
236
|
+
input[type='color']::-webkit-color-swatch-wrapper {
|
|
237
|
+
padding: 0;
|
|
238
|
+
}
|
|
239
|
+
input[type='color']::-webkit-color-swatch {
|
|
240
|
+
border: none;
|
|
241
|
+
}
|
|
242
|
+
rich-action {
|
|
243
|
+
margin: 2px 4px 2px 2px;
|
|
244
|
+
}
|
|
245
|
+
rich-action[active] {
|
|
246
|
+
background-color: #e8e8e8;
|
|
247
|
+
}
|
|
248
|
+
.arrow-icon {
|
|
249
|
+
margin-left: -6px;
|
|
250
|
+
}
|
|
251
251
|
`;
|
|
252
252
|
__decorate([
|
|
253
253
|
query('#fg-color')
|