@mediafly/js-ui 50.2.0-beta.1 → 50.2.1-0

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/CHANGELOG.md CHANGED
@@ -1,5 +1,10 @@
1
1
  ## @mediafly/js-ui changelog
2
2
 
3
+ **50.2.0**
4
+
5
+ * Removed legacy header styles on h1, h2, etc. Headers now require an `o-h1` class to use the default styles.
6
+ * Removed the `has-no-margin` class from headers, this is now the default state. The previous default margins can be applied using the class `vertical-margin`.
7
+
3
8
  **50.1.0**
4
9
 
5
10
  * Support readonly fields in the metadata form component
@@ -99,7 +99,7 @@ let FontSelectorController = class FontSelectorController {
99
99
  this.popularFontsText = this.translateFactory.instant('JSUI.POPULAR_FONTS');
100
100
  this.requiredText = this.translateFactory.instant('JSUI.REQUIRED');
101
101
  this.whatAreGoogleFonts = this.translateFactory.instant('JSUI.WHAT_ARE_GOOGLE_FONTS');
102
- // init list of popylar fonts
102
+ // init list of popular fonts
103
103
  this.googleWebfontsApiService.getFontList('popularity')
104
104
  .then(popularList => {
105
105
  this.popularFonts = popularList.map(f => f.family);
@@ -1,7 +1,9 @@
1
1
  /// <reference types="angular-sanitize" />
2
2
  /// <reference types="angular-mocks" />
3
3
  import { sanitize } from 'angular';
4
- import { FontFamilyStyle } from '../font-selector/font-selector';
4
+ import { Range } from 'quill';
5
+ import { Delta, EmitterSource } from 'quill/core';
6
+ import type { TranslateFactory } from '../translate/translate-factory';
5
7
  export default class RichTextComponentController implements ng.IComponentController {
6
8
  private $element;
7
9
  private $rootScope;
@@ -11,24 +13,23 @@ export default class RichTextComponentController implements ng.IComponentControl
11
13
  allowColorSelection?: boolean;
12
14
  allowFontSelection?: boolean;
13
15
  isRequired: boolean;
14
- protected cachedSelection?: {
15
- index: number;
16
- length: number;
17
- };
18
- protected fontStyle?: FontFamilyStyle;
16
+ protected cachedSelection?: Range | null;
17
+ protected colorInputId: string;
18
+ protected editorSizeId: string;
19
19
  protected fontSelectorId: string;
20
20
  protected requiredText: string;
21
21
  protected selectedColor: string;
22
22
  protected selectedFont: string;
23
+ protected toolbarId: string;
23
24
  protected validationForm: ng.IFormController;
24
25
  private colorPicker;
25
26
  private editor;
26
27
  private ngModelCtrl;
27
- private debouncedOnTextChange;
28
+ private debouncedSanitizeAndValidate;
28
29
  private DEFAULT_COLOR;
29
30
  private DEFAULT_FONT;
30
31
  private DEFAULT_SIZE;
31
- constructor($element: ng.IAugmentedJQuery, $rootScope: JSUIRootScope, $sanitize: sanitize.ISanitizeService, $timeout: ng.ITimeoutService, translateFactory: any);
32
+ constructor($element: ng.IAugmentedJQuery, $rootScope: JSUIRootScope, $sanitize: sanitize.ISanitizeService, $timeout: ng.ITimeoutService, translateFactory: TranslateFactory);
32
33
  $onChanges(changes: {
33
34
  isRequired?: ng.IChangesObject<boolean>;
34
35
  }): void;
@@ -38,14 +39,33 @@ export default class RichTextComponentController implements ng.IComponentControl
38
39
  protected colorChanged(): void;
39
40
  protected colorInputOpened(): void;
40
41
  protected fontSelected(fontFamily: string): void;
41
- protected manageValidity(): void;
42
- protected onTextChange(_delta: any, _oldContents: any, source: any): void;
43
- protected selectionChange(range: any, oldRange: any, source: any): void;
44
- private applyColor;
45
- private cacheSelection;
46
- private sanitizeContents;
47
- private formatToDefaults;
48
- private getFontFromLeaf;
49
- private updateFontDisplay;
50
- private updateColorDisplay;
42
+ /** The user entered/deleted/modified some text. Handle any formatting issues, then store the model. */
43
+ protected onTextChange(delta: Delta, _oldContents: Delta, source: EmitterSource): void;
44
+ /** The user moved the cursor. Fix missing formats and update the toolbar to reflect the current selection. */
45
+ protected selectionChange(range: Range, _oldRange: Range, source: EmitterSource): void;
46
+ private checkValidity;
47
+ /**
48
+ * Quill's "Clear formatting" button leaves us with no font, size, or color, so the style is inherited from the CSS.
49
+ * We don't want that: we want everything to be fully defined, so that the user-entered text can be faithfully
50
+ * reproduced elsewhere.
51
+ */
52
+ private fixClearFormatting;
53
+ /**
54
+ * Quill likes to default to no formatting: an empty paragraph has no font, size, or color, so the style is inherited
55
+ * from the CSS.
56
+ * We don't want that: we want everything to be fully defined, so that the user-entered text can be faithfully
57
+ * reproduced elsewhere.
58
+ * We try to get the format from the previous line, or fall back to the default.
59
+ */
60
+ private fixMissingFormats;
61
+ private getColorFromFormat;
62
+ private getFontFromFormat;
63
+ private getSizeFromFormat;
64
+ private sanitizeAndValidate;
65
+ /** Updates the color shown in the toolbar. Does not change the color being used in the text. */
66
+ private updateColorPicker;
67
+ /** Updates the font shown in the toolbar. Does not change the font being used in the text. */
68
+ private updateFontPicker;
69
+ /** Updates the size shown in the toolbar. Does not change the size being used in the text. */
70
+ private updateSizePicker;
51
71
  }
@@ -1,4 +1,4 @@
1
- <div id="toolbar" class="c-rich-text">
1
+ <div id="{{ $ctrl.toolbarId }}" class="c-rich-text">
2
2
 
3
3
  <span ng-if="$ctrl.allowFontSelection" class="ql-formats c-rich-text-font-container">
4
4
  <mfly:font-selector
@@ -9,7 +9,7 @@
9
9
  </span>
10
10
 
11
11
  <span class="ql-formats">
12
- <select id="editorSize" class="ql-size">
12
+ <select id="{{ $ctrl.editorSizeId }}" class="ql-size">
13
13
  <option value="10px" data-value="10px">10px</option>
14
14
  <option value="12px" data-value="12px">12px</option>
15
15
  <option value="14px" data-value="14px">14px</option>
@@ -22,7 +22,7 @@
22
22
 
23
23
  <!-- ng show for event handler -->
24
24
  <span ng-show="$ctrl.allowColorSelection" class="ql-formats">
25
- <input id="rteColorInput"
25
+ <input id="{{ $ctrl.colorInputId }}"
26
26
  type="color"
27
27
  ng-model="$ctrl.selectedColor">
28
28
  </span>
@@ -18,8 +18,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
18
18
  const angular_1 = __importDefault(require("angular"));
19
19
  const lodash_1 = __importDefault(require("lodash"));
20
20
  const quill_1 = __importDefault(require("quill"));
21
- const jquery_1 = __importDefault(require("jquery"));
22
21
  const decorators_1 = require("../decorators");
22
+ const uuid_1 = require("uuid");
23
23
  // text editor requires sanitization but also needs to allow for style attributes which are removed by default
24
24
  angular_1.default.module('app').config(['$sanitizeProvider', ($sanitizeProvider) => {
25
25
  $sanitizeProvider.addValidAttrs(['style']);
@@ -31,7 +31,7 @@ let RichTextComponentController = class RichTextComponentController {
31
31
  this.$sanitize = $sanitize;
32
32
  this.$timeout = $timeout;
33
33
  this.translateFactory = translateFactory;
34
- this.debouncedOnTextChange = lodash_1.default.debounce((delta, oldContents, source) => this.onTextChange(delta, oldContents, source), 250);
34
+ this.debouncedSanitizeAndValidate = lodash_1.default.debounce(() => this.sanitizeAndValidate(), 250);
35
35
  this.DEFAULT_COLOR = '#535353';
36
36
  this.DEFAULT_FONT = 'Roboto';
37
37
  this.DEFAULT_SIZE = '14px';
@@ -43,177 +43,265 @@ let RichTextComponentController = class RichTextComponentController {
43
43
  if (changes.isRequired.currentValue === changes.isRequired.previousValue) {
44
44
  return;
45
45
  }
46
- this.manageValidity();
46
+ this.checkValidity();
47
47
  }
48
48
  $onDestroy() {
49
- this.editor.off('text-change', this.debouncedOnTextChange);
50
- this.colorPicker.removeEventListener('change', this.colorChanged.bind(this));
51
- this.colorPicker.removeEventListener('click', this.colorInputOpened.bind(this));
49
+ var _a, _b;
50
+ this.editor.off('text-change', (delta, oldContents, source) => { this.onTextChange(delta, oldContents, source); });
51
+ (_a = this.colorPicker) === null || _a === void 0 ? void 0 : _a.removeEventListener('change', this.colorChanged.bind(this));
52
+ (_b = this.colorPicker) === null || _b === void 0 ? void 0 : _b.removeEventListener('click', this.colorInputOpened.bind(this));
52
53
  }
53
54
  $onInit() {
54
55
  this.requiredText = this.translateFactory.instant('JSUI.REQUIRED');
55
- this.selectedColor = this.DEFAULT_COLOR;
56
- this.selectedFont = this.DEFAULT_FONT;
57
- this.fontSelectorId = 'rteFontSelector' + Math.floor(Math.random() * 1000 + 1);
58
- this.colorPicker = document.getElementById('rteColorInput');
59
- this.colorPicker.addEventListener('change', this.colorChanged.bind(this));
60
- this.colorPicker.addEventListener('click', this.colorInputOpened.bind(this));
61
- // programatically reset size
62
- jquery_1.default('.ql-size').val(this.DEFAULT_SIZE);
56
+ this.colorInputId = 'rteColorInput-' + uuid_1.v4();
57
+ this.editorSizeId = 'rteEditorSize-' + uuid_1.v4();
58
+ this.fontSelectorId = 'rteFontSelector-' + uuid_1.v4();
59
+ this.toolbarId = 'rteToolbar-' + uuid_1.v4();
60
+ this.$timeout(() => {
61
+ var _a, _b;
62
+ this.colorPicker = document.getElementById(this.colorInputId);
63
+ (_a = this.colorPicker) === null || _a === void 0 ? void 0 : _a.addEventListener('change', this.colorChanged.bind(this));
64
+ (_b = this.colorPicker) === null || _b === void 0 ? void 0 : _b.addEventListener('click', this.colorInputOpened.bind(this));
65
+ this.updateFontPicker(this.DEFAULT_FONT);
66
+ this.updateSizePicker(this.DEFAULT_SIZE);
67
+ this.updateColorPicker(this.DEFAULT_COLOR);
68
+ });
63
69
  }
64
70
  $postLink() {
65
71
  quill_1.default.register(quill_1.default.import('attributors/class/background'), true);
66
72
  quill_1.default.register(quill_1.default.import('attributors/style/color'), true);
67
73
  const fontStyle = quill_1.default.import('attributors/style/font');
68
- fontStyle.whitelist = null; // fonts not in the allow-list get dropped on other edits (CE-6314)
74
+ // Setting the whitelist to undefined allows all fonts. (We don't know what fonts Google Fonts will give us.)
75
+ fontStyle.whitelist = undefined;
69
76
  quill_1.default.register(fontStyle, true);
70
77
  const fontSizeArr = ['10px', '12px', '14px', '16px', '20px', '24px', '32px', '42px', '54px', '68px', '84px', '98px'];
71
- const Size = quill_1.default.import('attributors/style/size');
72
- Size.whitelist = fontSizeArr;
73
- quill_1.default.register(Size, true);
78
+ const size = quill_1.default.import('attributors/style/size');
79
+ size.whitelist = fontSizeArr;
80
+ quill_1.default.register(size, true);
74
81
  const options = {
75
82
  modules: {
76
- toolbar: '#toolbar'
83
+ toolbar: `#${this.toolbarId}`,
77
84
  },
78
85
  theme: 'snow',
79
86
  };
80
- this.editor = new quill_1.default(this.$element.find('.js-rich-text-target')[0], options);
81
- // Disable spellcheck because of a bad bug that deletes text (CE-4692).
82
- this.editor.root.setAttribute('spellcheck', false);
83
- this.editor.on('text-change', this.debouncedOnTextChange);
84
- this.editor.on('selection-change', this.selectionChange.bind(this));
87
+ this.$timeout(() => {
88
+ this.editor = new quill_1.default(this.$element.find('.js-rich-text-target')[0], options);
89
+ // Disable spellcheck because of a bad bug that deletes text (CE-4692).
90
+ this.editor.root.setAttribute('spellcheck', 'false');
91
+ this.editor.on('text-change', (delta, oldContents, source) => { this.onTextChange(delta, oldContents, source); });
92
+ this.editor.on('selection-change', this.selectionChange.bind(this));
93
+ });
85
94
  this.ngModelCtrl.$render = () => {
86
- if (!this.ngModelCtrl.$viewValue) {
87
- this.editor.setText('\n');
88
- return;
89
- }
90
- this.editor.root.innerHTML = this.ngModelCtrl.$viewValue;
95
+ this.$timeout(() => {
96
+ if (!this.ngModelCtrl.$viewValue) {
97
+ this.editor.setText('\n');
98
+ return;
99
+ }
100
+ this.editor.root.innerHTML = this.ngModelCtrl.$viewValue;
101
+ });
91
102
  };
92
103
  }
93
104
  colorChanged() {
94
- this.applyColor();
105
+ // Re-apply the text selection that was made before selecting a color,
106
+ // as the act of hiding some browsers' color inputs can change the selected text
107
+ if (this.cachedSelection) {
108
+ this.editor.setSelection(this.cachedSelection.index, this.cachedSelection.length);
109
+ }
110
+ this.editor.format('color', this.selectedColor);
111
+ this.debouncedSanitizeAndValidate();
95
112
  }
96
113
  colorInputOpened() {
97
- this.cacheSelection();
114
+ this.cachedSelection = this.editor.getSelection();
98
115
  }
99
116
  fontSelected(fontFamily) {
100
117
  if (!fontFamily) {
101
118
  return;
102
119
  }
103
120
  this.$rootScope.$broadcast('richTextToolbarContainer:closeContainer');
104
- const fontAtributor = quill_1.default.import('attributors/style/font');
105
- fontAtributor.whitelist = [fontFamily];
106
- this.updateFontDisplay(fontFamily);
107
- quill_1.default.register(fontAtributor, true);
108
121
  this.editor.format('font', fontFamily);
109
- this.sanitizeContents();
110
- }
111
- manageValidity() {
112
- const isValid = !this.isRequired || !!this.ngModelCtrl.$viewValue;
113
- this.ngModelCtrl.$setValidity('required', isValid);
122
+ this.debouncedSanitizeAndValidate();
114
123
  }
115
- onTextChange(_delta, _oldContents, source) {
124
+ /** The user entered/deleted/modified some text. Handle any formatting issues, then store the model. */
125
+ onTextChange(delta, _oldContents, source) {
116
126
  if (source !== 'user') {
117
127
  return;
118
128
  }
119
- const userClearedEditor = (this.editor.root.innerHTML === `<p><br></p>`);
120
- if (userClearedEditor) {
121
- // reset the color picker to the default by passing an undefined range
122
- this.editor.root.innerHTML = '';
123
- this.updateColorDisplay(undefined);
124
- this.ngModelCtrl.$setViewValue(undefined);
125
- this.manageValidity();
126
- this.formatToDefaults();
129
+ this.$timeout(() => {
130
+ // Quill's "Clear formatting" button leaves us inheriting styles from the CSS. We want to keep things explicit.
131
+ this.fixClearFormatting(delta);
132
+ // Also, things like adding a line break can leave us with no style.
133
+ this.fixMissingFormats();
134
+ });
135
+ this.debouncedSanitizeAndValidate();
136
+ }
137
+ /** The user moved the cursor. Fix missing formats and update the toolbar to reflect the current selection. */
138
+ selectionChange(range, _oldRange, source) {
139
+ if (source !== 'user') {
127
140
  return;
128
141
  }
129
- this.sanitizeContents();
130
- const selection = this.editor.getSelection();
131
- if (!selection) {
142
+ if (!range) {
132
143
  return;
133
144
  }
134
- const format = this.editor.getFormat(selection.index, 0);
135
- // the following checks for an empty formatting
136
- if (lodash_1.default.isEmpty(format)) {
137
- // if format is empty then set back to default styles
138
- this.formatToDefaults();
145
+ this.fixMissingFormats();
146
+ this.$timeout(() => {
147
+ // Quill updates the toolbar to reflect most formatting (bold, italics, bullet points, etc.), but
148
+ // fonts, text size, and color are handled by plugins so we need to update those ourselves.
149
+ const format = this.editor.getFormat(range);
150
+ this.updateFontPicker(this.getFontFromFormat(format));
151
+ this.updateColorPicker(this.getColorFromFormat(format));
152
+ this.updateSizePicker(this.getSizeFromFormat(format));
153
+ });
154
+ }
155
+ checkValidity() {
156
+ const isValid = !this.isRequired || !!this.ngModelCtrl.$viewValue;
157
+ this.$timeout(() => {
158
+ this.ngModelCtrl.$setValidity('required', isValid);
159
+ });
160
+ }
161
+ /**
162
+ * Quill's "Clear formatting" button leaves us with no font, size, or color, so the style is inherited from the CSS.
163
+ * We don't want that: we want everything to be fully defined, so that the user-entered text can be faithfully
164
+ * reproduced elsewhere.
165
+ */
166
+ fixClearFormatting(delta) {
167
+ // Using the "Clear formatting" button creates a delta that sets font, size, and color to `null`. Detect any of those.
168
+ // (Usually you'd get all three together, but some might be missing from the delta if they were already clear,
169
+ // for example if we were editing an old Workspace Text Section that was created using an older version of this component.)
170
+ if (delta.ops.some((op) => {
171
+ var _a, _b, _c;
172
+ return op.retain && (((_a = op.attributes) === null || _a === void 0 ? void 0 : _a.font) === null || ((_b = op.attributes) === null || _b === void 0 ? void 0 : _b.size) === null || ((_c = op.attributes) === null || _c === void 0 ? void 0 : _c.color) === null);
173
+ })) {
174
+ this.editor.format('font', this.DEFAULT_FONT);
175
+ this.updateFontPicker(this.DEFAULT_FONT);
176
+ this.editor.format('size', this.DEFAULT_SIZE);
177
+ this.updateSizePicker(this.DEFAULT_SIZE);
178
+ this.editor.format('color', this.DEFAULT_COLOR);
179
+ this.updateColorPicker(this.DEFAULT_COLOR);
139
180
  }
140
181
  }
141
- selectionChange(range, oldRange, source) {
142
- if (source !== 'user') {
182
+ /**
183
+ * Quill likes to default to no formatting: an empty paragraph has no font, size, or color, so the style is inherited
184
+ * from the CSS.
185
+ * We don't want that: we want everything to be fully defined, so that the user-entered text can be faithfully
186
+ * reproduced elsewhere.
187
+ * We try to get the format from the previous line, or fall back to the default.
188
+ */
189
+ fixMissingFormats() {
190
+ // When debugging this, it can be useful to add this to your CSS to highlight problems:
191
+ // .ql-editor { color: #f0f; font-family: 'Wingdings', sans-serif; font-size: 9px; }
192
+ const selection = this.editor.getSelection();
193
+ if (!selection || selection.length) {
194
+ // Some text is selected; we don't want to change this
143
195
  return;
144
196
  }
145
- if (!range) {
197
+ const format = this.editor.getFormat();
198
+ if (format.font && format.size && format.color) {
199
+ // We are fully formatted; nothing more to do
146
200
  return;
147
201
  }
148
- const leaf = this.editor.getLeaf(range.index);
149
- const font = this.getFontFromLeaf(leaf);
150
- const format = this.editor.getFormat(range);
151
- this.updateColorDisplay(range);
152
- // if get format is empty we can switch to the defaults
153
- if (!format.size) {
154
- jquery_1.default('.ql-size').val(this.DEFAULT_SIZE);
155
- jquery_1.default('#editorSize .ql-picker-label').attr('data-value', this.DEFAULT_SIZE);
156
- jquery_1.default('#editorSize .ql-picker-label').attr('data-label', this.DEFAULT_SIZE);
202
+ // Copy missing format from the previous character (or the next, if we're at the start of the document)
203
+ const nearbyCharIndex = selection.index === 0 ? 1 : selection.index - 1;
204
+ const nearbyRange = {
205
+ index: nearbyCharIndex,
206
+ length: 0,
207
+ };
208
+ const nearbyFormat = this.editor.getFormat(nearbyRange);
209
+ this.editor.format('bold', nearbyFormat.bold);
210
+ this.editor.format('italic', nearbyFormat.italic);
211
+ this.editor.format('underline', nearbyFormat.underline);
212
+ if (!format.font) {
213
+ const font = this.getFontFromFormat(nearbyFormat);
214
+ this.editor.format('font', font);
215
+ this.updateFontPicker(font);
157
216
  }
158
- if (font) {
159
- this.updateFontDisplay(font.replace(/"/g, ''));
160
- return;
217
+ if (!format.size) {
218
+ const size = this.getSizeFromFormat(nearbyFormat);
219
+ this.editor.format('size', size);
220
+ this.updateSizePicker(size);
161
221
  }
162
- if (!format.font) {
163
- this.editor.format('font', this.DEFAULT_FONT);
222
+ if (!format.color) {
223
+ const color = this.getColorFromFormat(nearbyFormat);
224
+ this.editor.format('color', color);
225
+ this.updateColorPicker(color);
164
226
  }
165
227
  }
166
- applyColor() {
167
- // CE-3031: Re-apply the text selection that was made before selecting a color
168
- // as the act of hiding some browsers color inputs can change the selected text
169
- if (this.cachedSelection) {
170
- this.editor.setSelection(this.cachedSelection.index, this.cachedSelection.length);
228
+ getColorFromFormat(format) {
229
+ if (!format.color) {
230
+ // We get no color if the default color is selected; or if the selection contains multiple colors, one of which is the default.
231
+ return this.DEFAULT_COLOR;
171
232
  }
172
- this.editor.format('color', this.selectedColor);
173
- this.sanitizeContents();
174
- }
175
- cacheSelection() {
176
- this.cachedSelection = this.editor.getSelection();
233
+ if (typeof format.color === 'string') {
234
+ // The selected range is all the same color, which is not the default.
235
+ return format.color;
236
+ }
237
+ if (Array.isArray(format.color)) {
238
+ // The selected range contains multiple colors, none of which are the default. Return the default, to be consistent with other multi-color selections.
239
+ return this.DEFAULT_COLOR;
240
+ }
241
+ // Fall back to the default (should never get here)
242
+ return this.DEFAULT_COLOR;
177
243
  }
178
- sanitizeContents() {
179
- const html = this.$sanitize(this.editor.root.innerHTML);
180
- this.ngModelCtrl.$setViewValue(html);
181
- this.manageValidity();
244
+ getFontFromFormat(format) {
245
+ if (!format.font) {
246
+ // No font is defined for the selection, so show the default. This can happen if you're on a new empty line.
247
+ return this.DEFAULT_FONT;
248
+ }
249
+ if (typeof format.font === 'string') {
250
+ // The range uses a single font.
251
+ return format.font;
252
+ }
253
+ if (Array.isArray(format.font)) {
254
+ // The selected range contains multiple fonts, so show blank.
255
+ return '';
256
+ }
257
+ // Fall back to the default (should never get here)
258
+ return this.DEFAULT_FONT;
182
259
  }
183
- formatToDefaults() {
184
- this.updateFontDisplay(this.DEFAULT_FONT);
185
- this.editor.format('color', this.DEFAULT_COLOR);
186
- this.editor.format('size', this.DEFAULT_SIZE);
260
+ getSizeFromFormat(format) {
261
+ if (!format.size) {
262
+ // We get no size if the default size is selected; or if the selection contains multiple sizes, one of which is the default.
263
+ return this.DEFAULT_SIZE;
264
+ }
265
+ if (typeof format.size === 'string') {
266
+ // The selected range is all the same size, which is not the default.
267
+ return format.size;
268
+ }
269
+ if (Array.isArray(format.size)) {
270
+ // The selected range contains multiple sizes, none of which are the default. Return the first size in the array.
271
+ return format.size[0];
272
+ }
273
+ // Fall back to the default (should never get here)
274
+ return this.DEFAULT_FONT;
187
275
  }
188
- getFontFromLeaf(leaf) {
189
- if (!leaf) {
190
- return;
276
+ sanitizeAndValidate() {
277
+ let html;
278
+ // An empty Quill editor's html might be like:
279
+ // <p><span style="font-family: Roboto; font-size: 14px; color: rgb(83, 83, 83);"><span class="ql-cursor">&#65279;</span></span></p>
280
+ // Detect emptiness and return `undefined` instead, for easier "Required" validation.
281
+ if (!this.editor.getText().trim()) {
282
+ html = undefined;
191
283
  }
192
- if (!leaf[0].parent.domNode.style.fontFamily) {
193
- return;
284
+ else {
285
+ // Sometimes Quill's inner HTML includes its own cursor. We don't want to save that.
286
+ const withoutCursor = this.editor.root.innerHTML.replace(/\<span class="ql-cursor"\>.?\<\/span\>/, '');
287
+ html = this.$sanitize(withoutCursor);
194
288
  }
195
- return leaf[0].parent.domNode.style.fontFamily;
289
+ this.ngModelCtrl.$setViewValue(html);
290
+ this.checkValidity();
196
291
  }
197
- updateFontDisplay(fontFamily) {
198
- this.selectedFont = fontFamily;
199
- this.fontStyle = {
200
- 'font-family': fontFamily
201
- };
292
+ /** Updates the color shown in the toolbar. Does not change the color being used in the text. */
293
+ updateColorPicker(color) {
294
+ this.selectedColor = color;
202
295
  }
203
- updateColorDisplay(range) {
204
- this.$timeout(() => {
205
- const format = this.editor.getFormat(range);
206
- const color = format.color;
207
- if (!color || lodash_1.default.isEmpty(color)) {
208
- this.selectedColor = this.DEFAULT_COLOR;
209
- return;
210
- }
211
- if (lodash_1.default.isArray(color)) {
212
- this.selectedColor = color[0];
213
- return;
214
- }
215
- this.selectedColor = color;
216
- });
296
+ /** Updates the font shown in the toolbar. Does not change the font being used in the text. */
297
+ updateFontPicker(font) {
298
+ this.selectedFont = font;
299
+ }
300
+ /** Updates the size shown in the toolbar. Does not change the size being used in the text. */
301
+ updateSizePicker(size) {
302
+ this.$element.find('.ql-size').val(size);
303
+ this.$element.find(`#${this.editorSizeId} .ql-picker-label`).attr('data-value', size);
304
+ this.$element.find(`#${this.editorSizeId} .ql-picker-label`).attr('data-label', size);
217
305
  }
218
306
  };
219
307
  __decorate([
@@ -1 +1 @@
1
- {"version":3,"file":"rich-text.component.js","sourceRoot":"","sources":["../../src/components/rich-text/rich-text.component.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA,sDAA2C;AAC3C,oDAAsB;AACtB,kDAAyB;AACzB,oDAAsB;AAEtB,8CAAwD;AAExD,8GAA8G;AAC9G,iBAAO,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,MAAM,CAAC,CAAC,mBAAmB,EAAE,CAAC,iBAAgD,EAAE,EAAE;QACvG,iBAAiB,CAAC,aAAa,CAAC,CAAC,OAAO,CAAC,CAAC,CAAA;IAC3C,CAAC,CAAC,CAAC,CAAA;AAUH,IAAqB,2BAA2B,GAAhD,MAAqB,2BAA2B;IAwB/C,YAC6B,QAA6B,EAC3B,UAAyB,EAC1B,SAAoC,EACrC,QAA4B,EACpB,gBAAgB;QAJxB,aAAQ,GAAR,QAAQ,CAAqB;QAC3B,eAAU,GAAV,UAAU,CAAe;QAC1B,cAAS,GAAT,SAAS,CAA2B;QACrC,aAAQ,GAAR,QAAQ,CAAoB;QACpB,qBAAgB,GAAhB,gBAAgB,CAAA;QAX7C,0BAAqB,GAAG,gBAAC,CAAC,QAAQ,CAAC,CAAC,KAAK,EAAE,WAAW,EAAE,MAAM,EAAE,EAAE,CAAC,IAAI,CAAC,YAAY,CAAC,KAAK,EAAE,WAAW,EAAE,MAAM,CAAC,EAAE,GAAG,CAAC,CAAA;QAEtH,kBAAa,GAAG,SAAS,CAAA;QACzB,iBAAY,GAAG,QAAQ,CAAA;QACvB,iBAAY,GAAG,MAAM,CAAA;IAQ1B,CAAC;IAEJ,UAAU,CAAC,OAAoD;QAC9D,IAAI,CAAC,OAAO,CAAC,UAAU,EAAE;YAAE,OAAM;SAAE;QACnC,IAAI,OAAO,CAAC,UAAU,CAAC,YAAY,KAAK,OAAO,CAAC,UAAU,CAAC,aAAa,EAAE;YAAE,OAAM;SAAE;QAEpF,IAAI,CAAC,cAAc,EAA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