@mediafly/js-ui 47.2.1-beta.1 → 47.3.1-2
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 +4 -0
- package/lib/auto-complete/auto-complete.component.html +2 -1
- package/lib/font-selector/font-selector.d.ts +41 -8
- package/lib/font-selector/font-selector.html +67 -13
- package/lib/font-selector/font-selector.js +193 -19
- package/lib/font-selector/font-selector.js.map +1 -1
- package/lib/font-selector/google-webfonts-api.service.d.ts +1 -1
- package/lib/font-selector/google-webfonts-api.service.js +10 -2
- package/lib/font-selector/google-webfonts-api.service.js.map +1 -1
- package/lib/font-selector/webfont-loader.service.d.ts +1 -2
- package/lib/font-selector/webfont-loader.service.js +2 -2
- package/lib/font-selector/webfont-loader.service.js.map +1 -1
- package/lib/localization/index.strings.json +3 -1
- package/lib/rich-text/index.d.ts +0 -1
- package/lib/rich-text/index.js +0 -1
- package/lib/rich-text/index.js.map +1 -1
- package/lib/rich-text/rich-text.component.d.ts +2 -2
- package/lib/rich-text/rich-text.component.html +6 -14
- package/lib/rich-text/rich-text.component.js +6 -5
- package/lib/rich-text/rich-text.component.js.map +1 -1
- package/lib/tsconfig.deploy.tsbuildinfo +19 -31
- package/package.json +1 -1
- package/src/components/auto-complete/auto-complete.component.html +2 -1
- package/src/components/auto-complete/auto-complete.component.less +2 -1
- package/src/components/font-selector/font-selector.html +67 -13
- package/src/components/font-selector/font-selector.less +121 -0
- package/src/components/font-selector/font-selector.ts +214 -18
- package/src/components/font-selector/google-webfonts-api.backend.ts +1 -1
- package/src/components/font-selector/google-webfonts-api.service.ts +10 -2
- package/src/components/font-selector/webfont-loader.service.ts +2 -2
- package/src/components/index.less +1 -1
- package/src/components/localization/index.strings.json +3 -1
- package/src/components/rich-text/index.ts +0 -1
- package/src/components/rich-text/rich-text.component.html +6 -14
- package/src/components/rich-text/rich-text.component.less +5 -1
- package/src/components/rich-text/rich-text.component.ts +7 -5
- package/tsconfig.tsbuildinfo +46 -63
- package/lib/rich-text/rich-text-toolbar-container.component.d.ts +0 -16
- package/lib/rich-text/rich-text-toolbar-container.component.html +0 -12
- package/lib/rich-text/rich-text-toolbar-container.component.js +0 -75
- package/lib/rich-text/rich-text-toolbar-container.component.js.map +0 -1
- package/src/components/rich-text/rich-text-toolbar-container.component.html +0 -12
- package/src/components/rich-text/rich-text-toolbar-container.component.ts +0 -66
- package/src/components/rich-text/rich-text-toolbar-container.less +0 -21
package/CHANGELOG.md
CHANGED
|
@@ -27,7 +27,8 @@
|
|
|
27
27
|
test-value="$ctrl.inputValue">
|
|
28
28
|
</auto-complete-match-renderer>
|
|
29
29
|
|
|
30
|
-
<span ng-class="{ 'is-visible': $ctrl.isFetching }"
|
|
30
|
+
<span ng-class="{ 'is-visible': $ctrl.isFetching }"
|
|
31
|
+
class="far fa-spin fa-spinner c-auto-complete__spinner"></span>
|
|
31
32
|
|
|
32
33
|
<span ng-if="$ctrl.displayClose"
|
|
33
34
|
ng-click="$ctrl.clear()"
|
|
@@ -1,25 +1,58 @@
|
|
|
1
|
-
/// <reference types="google.fonts" />
|
|
2
1
|
/// <reference types="angular" />
|
|
2
|
+
/// <reference types="angular-mocks" />
|
|
3
3
|
import GoogleWebfontsApiService from './google-webfonts-api.service';
|
|
4
|
-
import { AutoCompleteMatchObject } from '../auto-complete/auto-complete-match-renderer.component';
|
|
5
4
|
import WebfontLoaderService from './webfont-loader.service';
|
|
6
5
|
import { TranslateFactory } from '../translate/translate-factory';
|
|
7
6
|
export interface FontFamilyStyle {
|
|
8
7
|
'font-family': string;
|
|
9
8
|
}
|
|
10
9
|
export default class FontSelectorController implements ng.IComponentController {
|
|
10
|
+
private $document;
|
|
11
|
+
private $element;
|
|
12
|
+
private $timeout;
|
|
13
|
+
private $q;
|
|
11
14
|
private googleWebfontsApiService;
|
|
12
15
|
private translateFactory;
|
|
13
16
|
private webfontLoaderService;
|
|
17
|
+
inputId: string;
|
|
14
18
|
isDisabled?: boolean;
|
|
15
19
|
isRequired?: boolean;
|
|
16
|
-
|
|
17
|
-
|
|
20
|
+
fontFamily?: string;
|
|
21
|
+
onFontSelect?: (param: {
|
|
22
|
+
fontFamily: string;
|
|
18
23
|
}) => void;
|
|
24
|
+
protected delay: number;
|
|
25
|
+
protected googleFonts: string[];
|
|
26
|
+
protected inputValue?: string;
|
|
27
|
+
protected interactionMode: 'mouse' | 'keyboard';
|
|
28
|
+
protected isDropdownVisible: boolean;
|
|
29
|
+
protected isFetching: boolean;
|
|
30
|
+
protected kbSelectedIndex: number;
|
|
31
|
+
protected keyEventElement: HTMLInputElement | null;
|
|
32
|
+
protected loadingFonts: boolean;
|
|
19
33
|
protected placeholderText: string;
|
|
20
|
-
|
|
21
|
-
protected
|
|
34
|
+
protected popularFonts: string[];
|
|
35
|
+
protected popularFontsText: string;
|
|
36
|
+
protected matches: string[];
|
|
37
|
+
protected minLength: number;
|
|
38
|
+
protected requiredText: string;
|
|
39
|
+
protected showPopular: boolean;
|
|
40
|
+
protected whatAreGoogleFonts: string;
|
|
41
|
+
private debouncedFetchAndSetMatches;
|
|
42
|
+
private inputElement;
|
|
43
|
+
private observer;
|
|
44
|
+
constructor($document: ng.IDocumentService, $element: ng.IAugmentedJQuery, $timeout: ng.ITimeoutService, $q: ng.IQService, googleWebfontsApiService: GoogleWebfontsApiService, translateFactory: TranslateFactory, webfontLoaderService: WebfontLoaderService);
|
|
45
|
+
$onDestroy(): void;
|
|
22
46
|
$onInit(): void;
|
|
23
|
-
protected
|
|
24
|
-
protected
|
|
47
|
+
protected clearInput($event: any): void;
|
|
48
|
+
protected clickSelect($event: any): void;
|
|
49
|
+
dropdownWasMousedOver(): void;
|
|
50
|
+
protected inputClick($event: any): void;
|
|
51
|
+
protected inputValueWasChanged(): void;
|
|
52
|
+
protected matchWasSelected(match: string): void;
|
|
53
|
+
protected onFontLookup(value: string): ng.IPromise<string[]>;
|
|
54
|
+
private fetchAndSetMatches;
|
|
55
|
+
private onClickElsewhere;
|
|
56
|
+
private onKeyDown;
|
|
57
|
+
private scrollToMatch;
|
|
25
58
|
}
|
|
@@ -1,13 +1,67 @@
|
|
|
1
|
-
<
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
1
|
+
<ng-form class="o-form c-font-selector" novalidate>
|
|
2
|
+
|
|
3
|
+
<div ng-click="$ctrl.clickSelect($event)"
|
|
4
|
+
ng-class="{'is-disabled': $ctrl.isDisabled}"
|
|
5
|
+
class="c-font-selector__select">
|
|
6
|
+
|
|
7
|
+
<div>{{ $ctrl.fontFamily }}</div>
|
|
8
|
+
|
|
9
|
+
<div class="fas fa-sort c-font-selector__select__icon"></div>
|
|
10
|
+
</div>
|
|
11
|
+
|
|
12
|
+
<div
|
|
13
|
+
ng-if="!$ctrl.fontFamily && $ctrl.isRequired"
|
|
14
|
+
class="c-font-selector__warning">{{ $ctrl.requiredText }}
|
|
15
|
+
</div>
|
|
16
|
+
|
|
17
|
+
<div ng-class="{'is-visible': $ctrl.isDropdownVisible,
|
|
18
|
+
'is-showing-popular': $ctrl.showPopular && !$ctrl.inputValue}"
|
|
19
|
+
class="c-font-selector__dropdown">
|
|
20
|
+
|
|
21
|
+
<input
|
|
22
|
+
ng-click="$ctrl.inputClick($event)"
|
|
23
|
+
ng-model="$ctrl.inputValue"
|
|
24
|
+
autocapitalize="off"
|
|
25
|
+
autocomplete="off"
|
|
26
|
+
autocorrect="off"
|
|
27
|
+
class="o-form-control c-font-selector__input"
|
|
28
|
+
id="{{ $ctrl.inputId }}"
|
|
29
|
+
name="autocomplete"
|
|
30
|
+
placeholder="{{ $ctrl.placeholderText }}"
|
|
31
|
+
type="text">
|
|
32
|
+
|
|
33
|
+
<span ng-class="{ 'is-visible': $ctrl.isFetching && $ctrl.inputValue.length >= $ctrl.minLength }"
|
|
34
|
+
class="far fa-spin fa-spinner c-font-selector__dropdown__spinner">
|
|
35
|
+
</span>
|
|
36
|
+
|
|
37
|
+
<span ng-if="!$ctrl.isFetching && $ctrl.inputValue.length >= $ctrl.minLength"
|
|
38
|
+
ng-click="$ctrl.clearInput($event)"
|
|
39
|
+
class="c-font-selector__dropdown__close fal fa-times-circle">
|
|
40
|
+
</span>
|
|
41
|
+
|
|
42
|
+
<div ng-if="$ctrl.showPopular && !$ctrl.inputValue" class="c-font-selector__dropdown__header">
|
|
43
|
+
<div class="c-font-selector__dropdown__header__label">{{ $ctrl.popularFontsText }} </div>
|
|
44
|
+
<div class="c-font-selector__dropdown__header__link">
|
|
45
|
+
<a class="o-link" href="https://fonts.google.com/" target="_blank">{{ $ctrl.whatAreGoogleFonts }}</a>
|
|
46
|
+
</div>
|
|
47
|
+
</div>
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
<div ng-mousemove="$ctrl.dropdownWasMousedOver($event)"
|
|
51
|
+
class="c-font-selector__dropdown__matches">
|
|
52
|
+
<div
|
|
53
|
+
class="c-font-selector__match-row"
|
|
54
|
+
data-test="auto-complete-match"
|
|
55
|
+
ng-class="[
|
|
56
|
+
($ctrl.interactionMode === 'mouse') ? 'with-mouse' : 'with-keyboard',
|
|
57
|
+
{ 'is-selected': ($ctrl.kbSelectedIndex === $index) },
|
|
58
|
+
]"
|
|
59
|
+
ng-style="{'font-family': match}"
|
|
60
|
+
ng-click="$ctrl.matchWasSelected(match)"
|
|
61
|
+
ng-repeat="match in $ctrl.matches">
|
|
62
|
+
<span>{{ match }}</span>
|
|
63
|
+
</div>
|
|
64
|
+
</div>
|
|
65
|
+
</div>
|
|
66
|
+
|
|
67
|
+
</ng-form>
|
|
@@ -13,45 +13,215 @@ var __param = (this && this.__param) || function (paramIndex, decorator) {
|
|
|
13
13
|
import { Component, Inject, Input, Output } from '../decorators';
|
|
14
14
|
import GoogleWebfontsApiService from './google-webfonts-api.service';
|
|
15
15
|
import WebfontLoaderService from './webfont-loader.service';
|
|
16
|
+
import _ from 'lodash';
|
|
16
17
|
let FontSelectorController = class FontSelectorController {
|
|
17
|
-
constructor(googleWebfontsApiService, translateFactory, webfontLoaderService) {
|
|
18
|
+
constructor($document, $element, $timeout, $q, googleWebfontsApiService, translateFactory, webfontLoaderService) {
|
|
19
|
+
this.$document = $document;
|
|
20
|
+
this.$element = $element;
|
|
21
|
+
this.$timeout = $timeout;
|
|
22
|
+
this.$q = $q;
|
|
18
23
|
this.googleWebfontsApiService = googleWebfontsApiService;
|
|
19
24
|
this.translateFactory = translateFactory;
|
|
20
25
|
this.webfontLoaderService = webfontLoaderService;
|
|
26
|
+
this.delay = 500;
|
|
27
|
+
this.interactionMode = 'mouse';
|
|
28
|
+
this.kbSelectedIndex = -1;
|
|
29
|
+
this.keyEventElement = null;
|
|
30
|
+
this.loadingFonts = true;
|
|
31
|
+
this.matches = [];
|
|
32
|
+
this.minLength = 2;
|
|
33
|
+
this.showPopular = true;
|
|
34
|
+
this.debouncedFetchAndSetMatches = _.debounce(() => this.fetchAndSetMatches(), this.delay);
|
|
35
|
+
this.onClickElsewhere = ($event) => {
|
|
36
|
+
this.$timeout(() => {
|
|
37
|
+
this.isDropdownVisible = false;
|
|
38
|
+
});
|
|
39
|
+
};
|
|
40
|
+
this.onKeyDown = ($event) => this.$timeout(() => {
|
|
41
|
+
this.interactionMode = 'keyboard';
|
|
42
|
+
// Enter with no selection: let the $event through
|
|
43
|
+
if ($event.key === 'Enter' && this.kbSelectedIndex === -1) {
|
|
44
|
+
return;
|
|
45
|
+
}
|
|
46
|
+
// If the dropdown is closed, all we can do is arrow down to open the thing
|
|
47
|
+
if (this.matches.length === 0 && $event.key !== 'ArrowDown') {
|
|
48
|
+
return;
|
|
49
|
+
}
|
|
50
|
+
// Escape: close the dropdown
|
|
51
|
+
if ($event.key === 'Escape') {
|
|
52
|
+
this.matches = this.popularFonts;
|
|
53
|
+
this.showPopular = true;
|
|
54
|
+
}
|
|
55
|
+
// Arrow down with dropdown closed: fetch matches
|
|
56
|
+
if ($event.key === 'ArrowDown' && this.matches.length === 0) {
|
|
57
|
+
this.fetchAndSetMatches();
|
|
58
|
+
}
|
|
59
|
+
// Arrow keys with dropdown open: move the selection highlight
|
|
60
|
+
if ($event.key === 'ArrowDown' && this.matches.length > 0) {
|
|
61
|
+
const idx = Math.min(this.kbSelectedIndex + 1, this.matches.length - 1);
|
|
62
|
+
this.kbSelectedIndex = idx;
|
|
63
|
+
this.scrollToMatch(idx);
|
|
64
|
+
}
|
|
65
|
+
if ($event.key === 'ArrowUp') {
|
|
66
|
+
const idx = Math.max(this.kbSelectedIndex - 1, 0);
|
|
67
|
+
this.kbSelectedIndex = idx;
|
|
68
|
+
this.scrollToMatch(idx);
|
|
69
|
+
}
|
|
70
|
+
// Enter with a selection: set the selection to the currently highlighted match
|
|
71
|
+
if ($event.key === 'Enter' && this.kbSelectedIndex > -1) {
|
|
72
|
+
const match = this.matches[this.kbSelectedIndex];
|
|
73
|
+
this.matchWasSelected(match);
|
|
74
|
+
$event.preventDefault();
|
|
75
|
+
}
|
|
76
|
+
$event.stopPropagation();
|
|
77
|
+
});
|
|
78
|
+
}
|
|
79
|
+
$onDestroy() {
|
|
80
|
+
if (this.keyEventElement) {
|
|
81
|
+
this.keyEventElement.removeEventListener('input', this.debouncedFetchAndSetMatches);
|
|
82
|
+
this.keyEventElement.removeEventListener('keydown', this.onKeyDown);
|
|
83
|
+
}
|
|
84
|
+
const body = this.$document[0].body;
|
|
85
|
+
body.removeEventListener('click', this.onClickElsewhere);
|
|
86
|
+
this.observer.disconnect();
|
|
21
87
|
}
|
|
22
88
|
$onInit() {
|
|
23
|
-
|
|
24
|
-
|
|
89
|
+
if (!this.inputId) {
|
|
90
|
+
throw new Error(`You must provide a string to key-event-element-id on the FontSelector.`);
|
|
91
|
+
}
|
|
92
|
+
// set labels and text
|
|
93
|
+
this.placeholderText = this.translateFactory.instant('JSUI.SEARCH_ALL_GOOGLE_FONTS');
|
|
94
|
+
this.popularFontsText = this.translateFactory.instant('JSUI.POPULAR_FONTS');
|
|
95
|
+
this.requiredText = this.translateFactory.instant('JSUI.REQUIRED');
|
|
96
|
+
this.whatAreGoogleFonts = this.translateFactory.instant('JSUI.WHAT_ARE_GOOGLE_FONTS');
|
|
97
|
+
// init list of popylar fonts
|
|
98
|
+
this.googleWebfontsApiService.getFontList('popularity')
|
|
99
|
+
.then(popularList => {
|
|
100
|
+
this.popularFonts = popularList.map(f => f.family);
|
|
101
|
+
this.popularFonts = this.popularFonts.slice(0, 50);
|
|
102
|
+
this.webfontLoaderService.loadFonts(this.popularFonts);
|
|
103
|
+
this.matches = this.popularFonts;
|
|
104
|
+
});
|
|
25
105
|
// init list of google fonts
|
|
26
106
|
this.googleWebfontsApiService.getFontList()
|
|
27
|
-
.then(fontList => {
|
|
107
|
+
.then(fontList => {
|
|
108
|
+
this.googleFonts = fontList.map(f => f.family);
|
|
109
|
+
this.loadingFonts = false;
|
|
110
|
+
});
|
|
111
|
+
const body = this.$document[0].body;
|
|
112
|
+
body.addEventListener('click', this.onClickElsewhere);
|
|
113
|
+
// Set up an observer that will find the input element and attach events when it is present.
|
|
114
|
+
this.observer = new MutationObserver(() => {
|
|
115
|
+
// expect the tag-input component to be defined in a div with the id autocomplete-tag-lookup
|
|
116
|
+
// this allows us to more reliably find the input to listen to when there are multiple instances of this combination
|
|
117
|
+
this.inputElement = this.$element.parent().find(`#${this.inputId}`)[0];
|
|
118
|
+
if (this.inputElement) {
|
|
119
|
+
this.keyEventElement = this.inputElement;
|
|
120
|
+
this.keyEventElement.addEventListener('input', this.debouncedFetchAndSetMatches);
|
|
121
|
+
this.keyEventElement.addEventListener('keydown', this.onKeyDown);
|
|
122
|
+
this.observer.disconnect();
|
|
123
|
+
}
|
|
124
|
+
});
|
|
125
|
+
this.observer.observe(body, { attributes: true, childList: true, characterData: false, subtree: true });
|
|
126
|
+
}
|
|
127
|
+
clearInput($event) {
|
|
128
|
+
this.inputValue = '';
|
|
129
|
+
this.matches = this.popularFonts;
|
|
130
|
+
this.showPopular = true;
|
|
131
|
+
$event.stopPropagation();
|
|
132
|
+
}
|
|
133
|
+
clickSelect($event) {
|
|
134
|
+
if (this.isDisabled) {
|
|
135
|
+
return;
|
|
136
|
+
}
|
|
137
|
+
this.isDropdownVisible = !this.isDropdownVisible;
|
|
138
|
+
if (this.isDropdownVisible) {
|
|
139
|
+
this.$timeout(() => {
|
|
140
|
+
this.inputElement.focus();
|
|
141
|
+
}, 250);
|
|
142
|
+
}
|
|
143
|
+
$event.stopPropagation();
|
|
144
|
+
}
|
|
145
|
+
// When the user mouses over the dropdown, we should remove any keyboard
|
|
146
|
+
// highlighting, since the mouse hover provides it too.
|
|
147
|
+
dropdownWasMousedOver() {
|
|
148
|
+
this.interactionMode = 'mouse';
|
|
149
|
+
this.kbSelectedIndex = -1;
|
|
150
|
+
}
|
|
151
|
+
inputClick($event) {
|
|
152
|
+
$event.stopPropagation();
|
|
153
|
+
}
|
|
154
|
+
inputValueWasChanged() {
|
|
155
|
+
this.debouncedFetchAndSetMatches();
|
|
156
|
+
}
|
|
157
|
+
matchWasSelected(match) {
|
|
158
|
+
this.matches = this.popularFonts;
|
|
159
|
+
this.showPopular = true;
|
|
160
|
+
this.kbSelectedIndex = -1;
|
|
161
|
+
this.inputValue = '';
|
|
162
|
+
this.fontFamily = match;
|
|
163
|
+
this.isDropdownVisible = false;
|
|
164
|
+
if (this.onFontSelect) {
|
|
165
|
+
this.onFontSelect({ fontFamily: this.fontFamily });
|
|
166
|
+
}
|
|
28
167
|
}
|
|
29
168
|
onFontLookup(value) {
|
|
169
|
+
value = value.toLocaleLowerCase();
|
|
170
|
+
// const fonts: google.fonts.WebfontFamily[] = []
|
|
30
171
|
const fonts = this.googleFonts.filter(font => {
|
|
31
|
-
return font.
|
|
172
|
+
return font.toLowerCase().includes(value);
|
|
32
173
|
});
|
|
33
174
|
// load this set with the api service
|
|
34
175
|
this.webfontLoaderService.loadFonts(fonts);
|
|
35
|
-
return
|
|
36
|
-
cssStyle: { 'font-family': font.family },
|
|
37
|
-
displayValue: font.family,
|
|
38
|
-
value: font
|
|
39
|
-
}));
|
|
176
|
+
return this.$q.resolve(fonts);
|
|
40
177
|
}
|
|
41
|
-
|
|
42
|
-
this.
|
|
178
|
+
fetchAndSetMatches() {
|
|
179
|
+
this.isFetching = true;
|
|
180
|
+
const input = this.inputValue || (this.keyEventElement ? this.keyEventElement.value : '');
|
|
181
|
+
if (input.length < this.minLength) {
|
|
182
|
+
this.$timeout(() => {
|
|
183
|
+
this.matches = this.popularFonts;
|
|
184
|
+
this.showPopular = true;
|
|
185
|
+
});
|
|
186
|
+
return;
|
|
187
|
+
}
|
|
188
|
+
this.isFetching = true;
|
|
189
|
+
// Wrap the entire fetch in a timeout so that fetching callbacks will
|
|
190
|
+
// be called correctly while the async part happens.
|
|
191
|
+
this.$timeout(() => {
|
|
192
|
+
this.$q.when(this.onFontLookup(input))
|
|
193
|
+
.then(matches => {
|
|
194
|
+
this.matches = matches;
|
|
195
|
+
this.showPopular = false;
|
|
196
|
+
this.isFetching = false;
|
|
197
|
+
});
|
|
198
|
+
});
|
|
199
|
+
}
|
|
200
|
+
scrollToMatch(index) {
|
|
201
|
+
const row = this.$element.find('.c-font-selector__match-row')[index];
|
|
202
|
+
if (row) {
|
|
203
|
+
row.scrollIntoView({ behavior: 'smooth', block: 'nearest' });
|
|
204
|
+
}
|
|
43
205
|
}
|
|
44
206
|
};
|
|
45
207
|
__decorate([
|
|
46
|
-
Input(),
|
|
208
|
+
Input('<'),
|
|
209
|
+
__metadata("design:type", String)
|
|
210
|
+
], FontSelectorController.prototype, "inputId", void 0);
|
|
211
|
+
__decorate([
|
|
212
|
+
Input('<'),
|
|
47
213
|
__metadata("design:type", Boolean)
|
|
48
214
|
], FontSelectorController.prototype, "isDisabled", void 0);
|
|
49
215
|
__decorate([
|
|
50
|
-
Input(),
|
|
216
|
+
Input('<'),
|
|
51
217
|
__metadata("design:type", Boolean)
|
|
52
218
|
], FontSelectorController.prototype, "isRequired", void 0);
|
|
53
219
|
__decorate([
|
|
54
|
-
|
|
220
|
+
Input('=?'),
|
|
221
|
+
__metadata("design:type", String)
|
|
222
|
+
], FontSelectorController.prototype, "fontFamily", void 0);
|
|
223
|
+
__decorate([
|
|
224
|
+
Output('&?'),
|
|
55
225
|
__metadata("design:type", Function)
|
|
56
226
|
], FontSelectorController.prototype, "onFontSelect", void 0);
|
|
57
227
|
FontSelectorController = __decorate([
|
|
@@ -59,10 +229,14 @@ FontSelectorController = __decorate([
|
|
|
59
229
|
selector: 'mflyFontSelector',
|
|
60
230
|
template: require('./font-selector.html')
|
|
61
231
|
}),
|
|
62
|
-
__param(0, Inject('
|
|
63
|
-
__param(1, Inject('
|
|
64
|
-
__param(2, Inject('
|
|
65
|
-
|
|
232
|
+
__param(0, Inject('$document')),
|
|
233
|
+
__param(1, Inject('$element')),
|
|
234
|
+
__param(2, Inject('$timeout')),
|
|
235
|
+
__param(3, Inject('$q')),
|
|
236
|
+
__param(4, Inject('googleWebfontsApiService')),
|
|
237
|
+
__param(5, Inject('translateFactory')),
|
|
238
|
+
__param(6, Inject('webfontLoaderService')),
|
|
239
|
+
__metadata("design:paramtypes", [Object, Object, Function, Function, GoogleWebfontsApiService, Object, WebfontLoaderService])
|
|
66
240
|
], FontSelectorController);
|
|
67
241
|
export default FontSelectorController;
|
|
68
242
|
//# sourceMappingURL=font-selector.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"font-selector.js","sourceRoot":"","sources":["../../src/components/font-selector/font-selector.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,eAAe,CAAA;AAChE,OAAO,wBAAwB,MAAM,+BAA+B,CAAA;
|
|
1
|
+
{"version":3,"file":"font-selector.js","sourceRoot":"","sources":["../../src/components/font-selector/font-selector.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,OAAO,EAAE,SAAS,E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E,OAAO,CAAC,sBAAsB,CAAC;KACzC,CAAC;IAkCC,WAAA,MAAM,CAAC,WAAW,CAAC,CAAA;IACnB,WAAA,MAAM,CAAC,UAAU,CAAC,CAAA;IAClB,WAAA,MAAM,CAAC,UAAU,CAAC,CAAA;IAClB,WAAA,MAAM,CAAC,IAAI,CAAC,CAAA;IACZ,WAAA,MAAM,CAAC,0BAA0B,CAAC,CAAA;IAClC,WAAA,MAAM,CAAC,kBAAkB,CAAC,CAAA;IAC1B,WAAA,MAAM,CAAC,sBAAsB,CAAC,CAAA;yEAFuC,wBAAwB,UAEhC,oBAAoB;GAtC/D,sBAAsB,CAmP1C;eAnPoB,sBAAsB"}
|
|
@@ -5,5 +5,5 @@ export default class GoogleWebfontsApiService {
|
|
|
5
5
|
private $http;
|
|
6
6
|
private apiSuccessHandler;
|
|
7
7
|
constructor($http: ng.IHttpService, apiSuccessHandler: ApiSuccessHandler);
|
|
8
|
-
getFontList(): ng.IPromise<google.fonts.WebfontFamily[]>;
|
|
8
|
+
getFontList(sort?: string): ng.IPromise<google.fonts.WebfontFamily[]>;
|
|
9
9
|
}
|
|
@@ -17,8 +17,16 @@ let GoogleWebfontsApiService = class GoogleWebfontsApiService {
|
|
|
17
17
|
this.$http = $http;
|
|
18
18
|
this.apiSuccessHandler = apiSuccessHandler;
|
|
19
19
|
}
|
|
20
|
-
getFontList() {
|
|
21
|
-
|
|
20
|
+
getFontList(sort) {
|
|
21
|
+
const call = 'https://www.googleapis.com/webfonts/v1/webfonts';
|
|
22
|
+
if (!sort) {
|
|
23
|
+
sort = 'alpha';
|
|
24
|
+
}
|
|
25
|
+
const params = {
|
|
26
|
+
key: 'AIzaSyB-3EKXiPv1rjJ0Ab3u4s9iUaTqHXMLVOI',
|
|
27
|
+
sort,
|
|
28
|
+
};
|
|
29
|
+
return this.$http.get(call, { params })
|
|
22
30
|
.then((response) => {
|
|
23
31
|
return this.apiSuccessHandler.response(response).items;
|
|
24
32
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"google-webfonts-api.service.js","sourceRoot":"","sources":["../../src/components/font-selector/google-webfonts-api.service.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,eAAe,CAAA;AAClD,OAAO,iBAAiB,MAAM,2CAA2C,CAAA;AAGzE,IAAqB,wBAAwB,GAA7C,MAAqB,wBAAwB;IAE5C,YAC0B,KAAsB,EACV,iBAAoC;QADhD,UAAK,GAAL,KAAK,CAAiB;QACV,sBAAiB,GAAjB,iBAAiB,CAAmB;IACtE,CAAC;IAGL,WAAW;
|
|
1
|
+
{"version":3,"file":"google-webfonts-api.service.js","sourceRoot":"","sources":["../../src/components/font-selector/google-webfonts-api.service.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,eAAe,CAAA;AAClD,OAAO,iBAAiB,MAAM,2CAA2C,CAAA;AAGzE,IAAqB,wBAAwB,GAA7C,MAAqB,wBAAwB;IAE5C,YAC0B,KAAsB,EACV,iBAAoC;QADhD,UAAK,GAAL,KAAK,CAAiB;QACV,sBAAiB,GAAjB,iBAAiB,CAAmB;IACtE,CAAC;IAGL,WAAW,CAAC,IAAa;QACxB,MAAM,IAAI,GAAG,iDAAiD,CAAA;QAE9D,IAAI,CAAC,IAAI,EAAE;YAAE,IAAI,GAAG,OAAO,CAAA;SAAE;QAE7B,MAAM,MAAM,GAAG;YACd,GAAG,EAAE,yCAAyC;YAC9C,IAAI;SACJ,CAAA;QACD,OAAO,IAAI,CAAC,KAAK,CAAC,GAAG,CAA2B,IAAI,EAAE,EAAE,MAAM,EAAE,CAAC;aAC/D,IAAI,CAAC,CAAC,QAAQ,EAAE,EAAE;YAClB,OAAO,IAAI,CAAC,iBAAiB,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC,KAAK,CAAA;QACvD,CAAC,CAAC,CAAA;IACJ,CAAC;CAED,CAAA;AAvBoB,wBAAwB;IAD5C,UAAU,CAAC,0BAA0B,CAAC;IAIpC,WAAA,MAAM,CAAC,OAAO,CAAC,CAAA;IACf,WAAA,MAAM,CAAC,mBAAmB,CAAC,CAAA;+CAA4B,iBAAiB;GAJtD,wBAAwB,CAuB5C;eAvBoB,wBAAwB"}
|
|
@@ -7,8 +7,8 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
|
7
7
|
import { Injectable } from '../decorators';
|
|
8
8
|
import WebFont from 'webfontloader';
|
|
9
9
|
let WebfontLoaderService = class WebfontLoaderService {
|
|
10
|
-
loadFonts(
|
|
11
|
-
const families = fontList.map(f => f.family)
|
|
10
|
+
loadFonts(families) {
|
|
11
|
+
// const families = fontList.map(f => f.family)
|
|
12
12
|
let hasFonts = true;
|
|
13
13
|
try {
|
|
14
14
|
WebFont.load({
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"webfont-loader.service.js","sourceRoot":"","sources":["../../src/components/font-selector/webfont-loader.service.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAA;AAC1C,OAAO,OAAO,MAAM,eAAe,CAAA;AAGnC,IAAqB,oBAAoB,GAAzC,MAAqB,oBAAoB;IAGxC,SAAS,CAAC,
|
|
1
|
+
{"version":3,"file":"webfont-loader.service.js","sourceRoot":"","sources":["../../src/components/font-selector/webfont-loader.service.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAA;AAC1C,OAAO,OAAO,MAAM,eAAe,CAAA;AAGnC,IAAqB,oBAAoB,GAAzC,MAAqB,oBAAoB;IAGxC,SAAS,CAAC,QAAkB;QAE3B,+CAA+C;QAC/C,IAAI,QAAQ,GAAG,IAAI,CAAA;QAEnB,IAAI;YACH,OAAO,CAAC,IAAI,CAAC;gBACZ,MAAM,EAAE;oBACP,QAAQ;iBACR;gBACD,OAAO,EAAE,IAAI;aACb,CAAC,CAAA;SACF;QACD,OAAO,GAAG,EAAE;YACX,QAAQ,GAAG,KAAK,CAAA;SAChB;gBACO;YACP,IAAI,QAAQ,EAAE;gBACb,OAAO,CAAC,IAAI,CAAC;oBACZ,MAAM,EAAE;wBACP,QAAQ;qBACR;oBACD,OAAO,EAAE,IAAI;iBACb,CAAC,CAAA;aACF;SACD;IACF,CAAC;CACD,CAAA;AA9BoB,oBAAoB;IADxC,UAAU,CAAC,sBAAsB,CAAC;GACd,oBAAoB,CA8BxC;eA9BoB,oBAAoB"}
|
|
@@ -30,11 +30,12 @@
|
|
|
30
30
|
"NO": "No",
|
|
31
31
|
"OK_GOT_IT": "OK, got it",
|
|
32
32
|
"PDF": "PDF",
|
|
33
|
+
"POPULAR_FONTS": "Popular Fonts",
|
|
33
34
|
"POWERPOINT": "PowerPoint",
|
|
34
35
|
"PRIVACY_POLICY": "Privacy Policy",
|
|
35
36
|
"RECENT_CHANGES": "Recent Changes",
|
|
36
37
|
"REQUIRED": "Required",
|
|
37
|
-
"
|
|
38
|
+
"SEARCH_ALL_GOOGLE_FONTS": "Search all Google fonts",
|
|
38
39
|
"STATUS_CHECK": "Status Check",
|
|
39
40
|
"SUPPORT": "Need help?",
|
|
40
41
|
"TERMS_OF_USE": "Terms of Use",
|
|
@@ -42,6 +43,7 @@
|
|
|
42
43
|
"UNKNOWN": "Unknown",
|
|
43
44
|
"USER": "User",
|
|
44
45
|
"VIDEO": "Video",
|
|
46
|
+
"WHAT_ARE_GOOGLE_FONTS": "What are Google Fonts?",
|
|
45
47
|
"WORD_DOC": "Word document",
|
|
46
48
|
"YES": "Yes",
|
|
47
49
|
"ZIP": "ZIP file"
|
package/lib/rich-text/index.d.ts
CHANGED
package/lib/rich-text/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/components/rich-text/index.ts"],"names":[],"mappings":"AAAA,OAAO,uBAAuB,CAAA
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/components/rich-text/index.ts"],"names":[],"mappings":"AAAA,OAAO,uBAAuB,CAAA"}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
/// <reference types="angular-sanitize" />
|
|
2
2
|
/// <reference types="angular-mocks" />
|
|
3
|
-
/// <reference types="google.fonts" />
|
|
4
3
|
import { sanitize } from 'angular';
|
|
5
4
|
import { FontFamilyStyle } from '../font-selector/font-selector';
|
|
6
5
|
export default class RichTextComponentController implements ng.IComponentController {
|
|
@@ -12,6 +11,7 @@ export default class RichTextComponentController implements ng.IComponentControl
|
|
|
12
11
|
protected allowColorSelection?: boolean;
|
|
13
12
|
protected allowFontSelection?: boolean;
|
|
14
13
|
protected fontStyle?: FontFamilyStyle;
|
|
14
|
+
protected fontSelectorId: string;
|
|
15
15
|
protected isRequired: boolean;
|
|
16
16
|
protected requiredText: string;
|
|
17
17
|
protected selectedColor: string;
|
|
@@ -32,7 +32,7 @@ export default class RichTextComponentController implements ng.IComponentControl
|
|
|
32
32
|
$onInit(): void;
|
|
33
33
|
$postLink(): void;
|
|
34
34
|
protected colorChanged(): void;
|
|
35
|
-
protected fontSelected(
|
|
35
|
+
protected fontSelected(fontFamily: string): void;
|
|
36
36
|
protected manageValidity(): void;
|
|
37
37
|
protected onTextChange(_delta: any, _oldContents: any, source: any): void;
|
|
38
38
|
protected selectionChange(range: any, oldRange: any, source: any): void;
|
|
@@ -1,19 +1,11 @@
|
|
|
1
1
|
<div id="toolbar" class="c-rich-text">
|
|
2
2
|
|
|
3
|
-
<span ng-if="$ctrl.allowFontSelection" class="ql-formats">
|
|
4
|
-
<mfly:
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
<mfly:toolbar-container>
|
|
10
|
-
<mfly:font-selector
|
|
11
|
-
label-text="{{ $ctrl.fontLabelText }}"
|
|
12
|
-
on-font-select="$ctrl.fontSelected(font)">
|
|
13
|
-
</mfly:font-selector>
|
|
14
|
-
</mfly:toolbar-container>
|
|
15
|
-
</mfly:rich-text-toolbar-container>
|
|
16
|
-
|
|
3
|
+
<span ng-if="$ctrl.allowFontSelection" class="ql-formats c-rich-text-font-container">
|
|
4
|
+
<mfly:font-selector
|
|
5
|
+
input-id="$ctrl.fontSelectorId"
|
|
6
|
+
font-family="$ctrl.selectedFont"
|
|
7
|
+
on-font-select="$ctrl.fontSelected(fontFamily)">
|
|
8
|
+
</mfly:font-selector>
|
|
17
9
|
</span>
|
|
18
10
|
|
|
19
11
|
<span class="ql-formats">
|
|
@@ -43,6 +43,7 @@ export default class RichTextComponentController {
|
|
|
43
43
|
this.requiredText = this.translateFactory.instant('JSUI.REQUIRED');
|
|
44
44
|
this.selectedColor = this.DEFAULT_COLOR;
|
|
45
45
|
this.selectedFont = this.DEFAULT_FONT;
|
|
46
|
+
this.fontSelectorId = 'rteFontSelector' + Math.floor(Math.random() * 1000 + 1);
|
|
46
47
|
this.colorPicker = document.getElementById('rteColorInput');
|
|
47
48
|
this.colorPicker.addEventListener('change', this.colorChanged.bind(this));
|
|
48
49
|
// programatically reset size
|
|
@@ -80,14 +81,14 @@ export default class RichTextComponentController {
|
|
|
80
81
|
colorChanged() {
|
|
81
82
|
this.applyColor();
|
|
82
83
|
}
|
|
83
|
-
fontSelected(
|
|
84
|
-
if (
|
|
84
|
+
fontSelected(fontFamily) {
|
|
85
|
+
if (fontFamily) {
|
|
85
86
|
this.$rootScope.$broadcast('richTextToolbarContainer:closeContainer');
|
|
86
87
|
const fontAtributor = Quill.import('attributors/style/font');
|
|
87
|
-
fontAtributor.whitelist = [
|
|
88
|
-
this.updateFontDisplay(
|
|
88
|
+
fontAtributor.whitelist = [fontFamily];
|
|
89
|
+
this.updateFontDisplay(fontFamily);
|
|
89
90
|
Quill.register(fontAtributor, true);
|
|
90
|
-
this.editor.format('font',
|
|
91
|
+
this.editor.format('font', fontFamily);
|
|
91
92
|
this.sanitizeContents();
|
|
92
93
|
}
|
|
93
94
|
}
|