@mediafly/js-ui 47.2.1 → 47.3.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 +2 -18
- package/lib/auto-complete/auto-complete-match-renderer.component.d.ts +0 -5
- package/lib/auto-complete/auto-complete-match-renderer.component.js +5 -23
- package/lib/auto-complete/auto-complete-match-renderer.component.js.map +1 -1
- package/lib/auto-complete/auto-complete.component.html +2 -1
- package/lib/font-selector/font-selector.d.ts +37 -8
- package/lib/font-selector/font-selector.html +58 -13
- package/lib/font-selector/font-selector.js +174 -17
- 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/jsui.module.css +13 -2
- 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/styles.css +25 -16
- package/lib/tsconfig.deploy.tsbuildinfo +19 -31
- package/package.json +2 -2
- package/src/components/auto-complete/auto-complete-match-renderer.component.ts +6 -31
- 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 +58 -13
- package/src/components/font-selector/font-selector.less +100 -0
- package/src/components/font-selector/font-selector.ts +191 -17
- 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/less/objects/buttons.less +8 -0
- package/src/components/less/objects/buttons.module.css +11 -0
- package/src/components/less/variables/colors.less +2 -2
- package/src/components/less/variables.module.css +2 -2
- 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 +48 -65
- 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
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
@import '../less/variables/colors.less';
|
|
2
|
+
|
|
3
|
+
.c-font-selector {
|
|
4
|
+
display: block;
|
|
5
|
+
position: relative;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
.c-font-selector__select {
|
|
9
|
+
background-color: #fff;
|
|
10
|
+
border: 1px solid @color-gray-x-light;
|
|
11
|
+
border-radius: 3px;
|
|
12
|
+
color: @color-gray-x-dark;
|
|
13
|
+
cursor: pointer;
|
|
14
|
+
display: grid;
|
|
15
|
+
font-size: 14px;
|
|
16
|
+
grid-template-columns: auto 8px;
|
|
17
|
+
height: 34px;
|
|
18
|
+
line-height: 1.7;
|
|
19
|
+
padding: 5px 12px;
|
|
20
|
+
width: 100%;
|
|
21
|
+
|
|
22
|
+
&.is-disabled {
|
|
23
|
+
background-color: @color-gray-x-light;
|
|
24
|
+
cursor: not-allowed;
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
.c-font-selector__select__icon {
|
|
29
|
+
padding-top: 4px;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
.c-font-selector__warning {
|
|
33
|
+
color: @color-danger;
|
|
34
|
+
position: absolute;
|
|
35
|
+
right: 0;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
.c-font-selector__dropdown {
|
|
39
|
+
background-color: #fff;
|
|
40
|
+
border: 1px solid @color-gray-x-light;
|
|
41
|
+
border-radius: 4px;
|
|
42
|
+
box-shadow: @dropdown-box-shadow;
|
|
43
|
+
display: none;
|
|
44
|
+
max-height: 300px;
|
|
45
|
+
position: absolute;
|
|
46
|
+
top: 36px;
|
|
47
|
+
width: 370px;
|
|
48
|
+
z-index: 2;
|
|
49
|
+
|
|
50
|
+
&.is-visible {
|
|
51
|
+
display: block;
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
.o-form-control.c-font-selector__input {
|
|
56
|
+
margin: 4px 3px 10px;
|
|
57
|
+
outline: none;
|
|
58
|
+
padding-right: 36px; // add padding to not allow text under close button
|
|
59
|
+
width: 362px;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
.c-font-selector__dropdown__spinner.far {
|
|
63
|
+
// combination selector used to override FA styles
|
|
64
|
+
display: none;
|
|
65
|
+
position: absolute;
|
|
66
|
+
right: 10px;
|
|
67
|
+
top: 14px;
|
|
68
|
+
|
|
69
|
+
&.is-visible {
|
|
70
|
+
display: inline;
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
.c-font-selector__dropdown__close {
|
|
75
|
+
cursor: pointer;
|
|
76
|
+
display: inline;
|
|
77
|
+
font-size: 20px;
|
|
78
|
+
position: absolute;
|
|
79
|
+
right: 10px;
|
|
80
|
+
top: 11px;
|
|
81
|
+
|
|
82
|
+
&:hover {
|
|
83
|
+
color: @color-gray-x-dark;
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
.c-font-selector__dropdown__matches {
|
|
88
|
+
max-height: 250px;
|
|
89
|
+
overflow-y: auto;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
.c-font-selector__match-row {
|
|
93
|
+
cursor: pointer;
|
|
94
|
+
padding: 5px 10px;
|
|
95
|
+
|
|
96
|
+
&.with-mouse:hover,
|
|
97
|
+
&.with-keyboard.is-selected {
|
|
98
|
+
background-color: @color-gray-xx-light;
|
|
99
|
+
}
|
|
100
|
+
}
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import { Component, Inject, Input, Output } from '../decorators'
|
|
2
2
|
import GoogleWebfontsApiService from './google-webfonts-api.service'
|
|
3
|
-
import { AutoCompleteMatchObject } from '../auto-complete/auto-complete-match-renderer.component'
|
|
4
3
|
import WebfontLoaderService from './webfont-loader.service'
|
|
5
4
|
import { TranslateFactory } from '../translate/translate-factory'
|
|
6
|
-
|
|
5
|
+
import _ from 'lodash'
|
|
7
6
|
|
|
8
7
|
export interface FontFamilyStyle {
|
|
9
8
|
'font-family': string
|
|
@@ -16,48 +15,223 @@ export interface FontFamilyStyle {
|
|
|
16
15
|
|
|
17
16
|
export default class FontSelectorController implements ng.IComponentController {
|
|
18
17
|
|
|
19
|
-
@Input()
|
|
20
|
-
@Input()
|
|
21
|
-
@
|
|
22
|
-
|
|
18
|
+
@Input('<') inputId!: string
|
|
19
|
+
@Input('<') isDisabled?: boolean
|
|
20
|
+
@Input('<') isRequired?: boolean
|
|
21
|
+
@Input('=?') fontFamily?: string
|
|
22
|
+
|
|
23
|
+
@Output('&?') onFontSelect?: (param: { fontFamily: string }) => void
|
|
24
|
+
|
|
25
|
+
protected delay: number = 500
|
|
26
|
+
protected googleFonts: string[]
|
|
27
|
+
protected inputValue?: string
|
|
28
|
+
protected interactionMode: 'mouse' | 'keyboard' = 'mouse'
|
|
29
|
+
protected isDropdownVisible: boolean
|
|
30
|
+
protected isFetching: boolean
|
|
31
|
+
protected kbSelectedIndex = -1
|
|
32
|
+
protected keyEventElement: HTMLInputElement | null = null
|
|
33
|
+
protected loadingFonts: boolean = true
|
|
23
34
|
protected placeholderText!: string
|
|
35
|
+
protected matches: string[] = []
|
|
36
|
+
protected minLength: number = 2
|
|
37
|
+
protected requiredText: string
|
|
38
|
+
|
|
39
|
+
private debouncedFetchAndSetMatches = _.debounce(() => this.fetchAndSetMatches(), this.delay)
|
|
40
|
+
private inputElement: HTMLElement
|
|
41
|
+
private observer: MutationObserver
|
|
24
42
|
|
|
25
43
|
constructor (
|
|
44
|
+
@Inject('$document') private $document: ng.IDocumentService,
|
|
45
|
+
@Inject('$element') private $element: ng.IAugmentedJQuery,
|
|
46
|
+
@Inject('$timeout') private $timeout: ng.ITimeoutService,
|
|
47
|
+
@Inject('$q') private $q: ng.IQService,
|
|
26
48
|
@Inject('googleWebfontsApiService') private googleWebfontsApiService: GoogleWebfontsApiService,
|
|
27
49
|
@Inject('translateFactory') private translateFactory: TranslateFactory,
|
|
28
50
|
@Inject('webfontLoaderService') private webfontLoaderService: WebfontLoaderService,
|
|
29
51
|
) {}
|
|
30
52
|
|
|
31
|
-
|
|
53
|
+
$onDestroy() {
|
|
54
|
+
if (this.keyEventElement) {
|
|
55
|
+
this.keyEventElement.removeEventListener('input', this.debouncedFetchAndSetMatches)
|
|
56
|
+
this.keyEventElement.removeEventListener('keydown', this.onKeyDown)
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
const body = (this.$document[0] as Document).body
|
|
60
|
+
body.removeEventListener('click', this.onClickElsewhere)
|
|
61
|
+
|
|
62
|
+
this.observer.disconnect()
|
|
63
|
+
}
|
|
32
64
|
|
|
33
65
|
$onInit() {
|
|
66
|
+
if (!this.inputId) { throw new Error(`You must provide a string to key-event-element-id on the AutoCompleteMatchRenderer.`) }
|
|
34
67
|
// set label text
|
|
35
68
|
this.placeholderText = this.translateFactory.instant('JSUI.SEARCH_FONTS')
|
|
36
69
|
|
|
70
|
+
this.requiredText = this.translateFactory.instant('JSUI.REQUIRED')
|
|
71
|
+
|
|
37
72
|
// init list of google fonts
|
|
38
73
|
this.googleWebfontsApiService.getFontList()
|
|
39
|
-
.then(fontList => {
|
|
74
|
+
.then(fontList => {
|
|
75
|
+
this.googleFonts = fontList.map(f => f.family)
|
|
76
|
+
this.loadingFonts = false
|
|
77
|
+
})
|
|
78
|
+
|
|
79
|
+
const body = (this.$document[0] as Document).body
|
|
80
|
+
body.addEventListener('click', this.onClickElsewhere)
|
|
81
|
+
|
|
82
|
+
// Set up an observer that will find the input element and attach events when it is present.
|
|
83
|
+
this.observer = new MutationObserver(() => {
|
|
84
|
+
// expect the tag-input component to be defined in a div with the id autocomplete-tag-lookup
|
|
85
|
+
// this allows us to more reliably find the input to listen to when there are multiple instances of this combination
|
|
86
|
+
this.inputElement = this.$element.parent().find(`#${this.inputId}`)[0]
|
|
87
|
+
if (this.inputElement) {
|
|
88
|
+
this.keyEventElement = this.inputElement as HTMLInputElement
|
|
89
|
+
this.keyEventElement.addEventListener('input', this.debouncedFetchAndSetMatches)
|
|
90
|
+
this.keyEventElement.addEventListener('keydown', this.onKeyDown)
|
|
91
|
+
this.observer.disconnect()
|
|
92
|
+
}
|
|
93
|
+
})
|
|
94
|
+
|
|
95
|
+
this.observer.observe(body, { attributes: true, childList: true, characterData: false, subtree: true })
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
protected clearInput($event): void {
|
|
99
|
+
this.inputValue = ''
|
|
100
|
+
$event.stopPropagation()
|
|
40
101
|
}
|
|
41
102
|
|
|
42
|
-
protected
|
|
103
|
+
protected clickSelect($event): void {
|
|
104
|
+
if (this.isDisabled) { return }
|
|
105
|
+
this.isDropdownVisible = !this.isDropdownVisible
|
|
106
|
+
if (this.isDropdownVisible) {
|
|
107
|
+
this.$timeout(() => {
|
|
108
|
+
this.inputElement.focus()
|
|
109
|
+
}, 250)
|
|
110
|
+
}
|
|
111
|
+
$event.stopPropagation()
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
// When the user mouses over the dropdown, we should remove any keyboard
|
|
115
|
+
// highlighting, since the mouse hover provides it too.
|
|
116
|
+
dropdownWasMousedOver() {
|
|
117
|
+
this.interactionMode = 'mouse'
|
|
118
|
+
this.kbSelectedIndex = -1
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
protected inputClick($event): void{
|
|
122
|
+
$event.stopPropagation()
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
protected inputValueWasChanged() {
|
|
126
|
+
this.debouncedFetchAndSetMatches()
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
protected matchWasSelected(match: string) {
|
|
130
|
+
this.matches = []
|
|
131
|
+
this.kbSelectedIndex = -1
|
|
132
|
+
this.inputValue = ''
|
|
133
|
+
this.fontFamily = match
|
|
134
|
+
this.isDropdownVisible = false
|
|
135
|
+
if (this.onFontSelect) {
|
|
136
|
+
this.onFontSelect({fontFamily: this.fontFamily})
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
protected onFontLookup(value: string): ng.IPromise<string[]> {
|
|
141
|
+
|
|
142
|
+
value = value.toLocaleLowerCase()
|
|
43
143
|
|
|
144
|
+
// const fonts: google.fonts.WebfontFamily[] = []
|
|
44
145
|
const fonts = this.googleFonts.filter(font => {
|
|
45
|
-
return font.
|
|
146
|
+
return font.toLowerCase().includes(value)
|
|
46
147
|
})
|
|
47
148
|
|
|
48
149
|
// load this set with the api service
|
|
49
150
|
this.webfontLoaderService.loadFonts(fonts)
|
|
50
151
|
|
|
152
|
+
return this.$q.resolve(fonts)
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
private fetchAndSetMatches(): void {
|
|
156
|
+
|
|
157
|
+
this.isFetching = true
|
|
51
158
|
|
|
52
|
-
|
|
53
|
-
cssStyle: { 'font-family': font.family } as FontFamilyStyle,
|
|
54
|
-
displayValue: font.family,
|
|
55
|
-
value: font
|
|
56
|
-
}))
|
|
159
|
+
const input = this.inputValue || (this.keyEventElement ? this.keyEventElement.value : '')
|
|
57
160
|
|
|
161
|
+
if (input.length < this.minLength) {
|
|
162
|
+
this.$timeout(() => {
|
|
163
|
+
this.matches = []
|
|
164
|
+
})
|
|
165
|
+
return
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
this.isFetching = true
|
|
169
|
+
|
|
170
|
+
// Wrap the entire fetch in a timeout so that fetching callbacks will
|
|
171
|
+
// be called correctly while the async part happens.
|
|
172
|
+
this.$timeout(() => {
|
|
173
|
+
this.$q.when(this.onFontLookup(input))
|
|
174
|
+
.then(matches => {
|
|
175
|
+
this.matches = matches
|
|
176
|
+
this.isFetching = false
|
|
177
|
+
})
|
|
178
|
+
})
|
|
58
179
|
}
|
|
59
180
|
|
|
60
|
-
|
|
61
|
-
|
|
181
|
+
private onClickElsewhere = ($event: MouseEvent) => {
|
|
182
|
+
|
|
183
|
+
this.$timeout(() => {
|
|
184
|
+
this.isDropdownVisible = false
|
|
185
|
+
})
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
private onKeyDown = ($event: KeyboardEvent) => this.$timeout(() => {
|
|
189
|
+
|
|
190
|
+
this.interactionMode = 'keyboard'
|
|
191
|
+
|
|
192
|
+
// Enter with no selection: let the $event through
|
|
193
|
+
if ($event.key === 'Enter' && this.kbSelectedIndex === -1) { return }
|
|
194
|
+
|
|
195
|
+
// If the dropdown is closed, all we can do is arrow down to open the thing
|
|
196
|
+
if (this.matches.length === 0 && $event.key !== 'ArrowDown') { return }
|
|
197
|
+
|
|
198
|
+
// Escape: close the dropdown
|
|
199
|
+
if ($event.key === 'Escape') { this.matches = [] }
|
|
200
|
+
|
|
201
|
+
// Arrow down with dropdown closed: fetch matches
|
|
202
|
+
if ($event.key === 'ArrowDown' && this.matches.length === 0) {
|
|
203
|
+
this.fetchAndSetMatches()
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
// Arrow keys with dropdown open: move the selection highlight
|
|
207
|
+
if ($event.key === 'ArrowDown' && this.matches.length > 0) {
|
|
208
|
+
const idx = Math.min(this.kbSelectedIndex + 1, this.matches.length - 1)
|
|
209
|
+
this.kbSelectedIndex = idx
|
|
210
|
+
this.scrollToMatch(idx)
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
if ($event.key === 'ArrowUp') {
|
|
214
|
+
const idx = Math.max(this.kbSelectedIndex - 1, 0)
|
|
215
|
+
this.kbSelectedIndex = idx
|
|
216
|
+
this.scrollToMatch(idx)
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
// Enter with a selection: set the selection to the currently highlighted match
|
|
220
|
+
if ($event.key === 'Enter' && this.kbSelectedIndex > -1) {
|
|
221
|
+
const match = this.matches[this.kbSelectedIndex]
|
|
222
|
+
this.matchWasSelected(match)
|
|
223
|
+
$event.preventDefault()
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
$event.stopPropagation()
|
|
227
|
+
})
|
|
228
|
+
|
|
229
|
+
private scrollToMatch(index: number) {
|
|
230
|
+
|
|
231
|
+
const row = this.$element.find('.c-font-selector__match-row')[index] as HTMLDivElement
|
|
232
|
+
if (row) {
|
|
233
|
+
row.scrollIntoView({ behavior: 'smooth', block: 'nearest' })
|
|
234
|
+
}
|
|
62
235
|
}
|
|
236
|
+
|
|
63
237
|
}
|
|
@@ -3,6 +3,6 @@ import angular from 'angular'
|
|
|
3
3
|
angular.module('app').run((
|
|
4
4
|
$httpBackend: ng.IHttpBackendService
|
|
5
5
|
) => {
|
|
6
|
-
$httpBackend.whenGET(
|
|
6
|
+
$httpBackend.whenGET(/^https:\/\/www.googleapis.com\/webfonts\/v1\/webfonts\?key=AIzaSyB-3EKXiPv1rjJ0Ab3u4s9iUaTqHXMLVOI(.*)?/).passThrough()
|
|
7
7
|
})
|
|
8
8
|
|
|
@@ -10,8 +10,16 @@ export default class GoogleWebfontsApiService {
|
|
|
10
10
|
) { }
|
|
11
11
|
|
|
12
12
|
|
|
13
|
-
getFontList(): ng.IPromise<google.fonts.WebfontFamily[]> {
|
|
14
|
-
|
|
13
|
+
getFontList(sort?: string): ng.IPromise<google.fonts.WebfontFamily[]> {
|
|
14
|
+
const call = 'https://www.googleapis.com/webfonts/v1/webfonts'
|
|
15
|
+
|
|
16
|
+
if (!sort) { sort = 'alpha' }
|
|
17
|
+
|
|
18
|
+
const params = {
|
|
19
|
+
key: 'AIzaSyB-3EKXiPv1rjJ0Ab3u4s9iUaTqHXMLVOI',
|
|
20
|
+
sort,
|
|
21
|
+
}
|
|
22
|
+
return this.$http.get<google.fonts.WebfontList>(call, { params })
|
|
15
23
|
.then((response) => {
|
|
16
24
|
return this.apiSuccessHandler.response(response).items
|
|
17
25
|
})
|
|
@@ -5,9 +5,9 @@ import WebFont from 'webfontloader'
|
|
|
5
5
|
export default class WebfontLoaderService {
|
|
6
6
|
|
|
7
7
|
|
|
8
|
-
loadFonts(
|
|
8
|
+
loadFonts(families: string[]): void {
|
|
9
9
|
|
|
10
|
-
const families = fontList.map(f => f.family)
|
|
10
|
+
// const families = fontList.map(f => f.family)
|
|
11
11
|
let hasFonts = true
|
|
12
12
|
|
|
13
13
|
try {
|
|
@@ -9,6 +9,7 @@
|
|
|
9
9
|
@import './dropdown/dropdown';
|
|
10
10
|
@import './feedback/feedback';
|
|
11
11
|
@import './first-time-motivator/first-time-motivator';
|
|
12
|
+
@import './font-selector/font-selector';
|
|
12
13
|
@import './footer/footer';
|
|
13
14
|
@import './hierarchy/hierarchy';
|
|
14
15
|
@import './hover-tooltip/hover-tooltip';
|
|
@@ -24,7 +25,6 @@
|
|
|
24
25
|
@import './paging/paging';
|
|
25
26
|
@import './progress-bar/progress-bar';
|
|
26
27
|
@import './progress-circle/progress-circle';
|
|
27
|
-
@import './rich-text/rich-text-toolbar-container.less';
|
|
28
28
|
@import './rich-text/rich-text.component.less';
|
|
29
29
|
@import './site-header/site-header';
|
|
30
30
|
@import './slides/slides';
|
|
@@ -182,12 +182,20 @@
|
|
|
182
182
|
// Small button
|
|
183
183
|
// -------------------------------------------------
|
|
184
184
|
&.o-button--small {
|
|
185
|
+
background: #fff;
|
|
186
|
+
border: 1px solid @color-gray-x-light;
|
|
185
187
|
border-radius: 16px;
|
|
186
188
|
font-size: 13px;
|
|
187
189
|
font-weight: @font-weight-regular;
|
|
188
190
|
line-height: 1;
|
|
189
191
|
padding: 6px 12px;
|
|
190
192
|
white-space: nowrap;
|
|
193
|
+
|
|
194
|
+
@media (hover) {
|
|
195
|
+
&:hover {
|
|
196
|
+
.hover-button();
|
|
197
|
+
}
|
|
198
|
+
}
|
|
191
199
|
}
|
|
192
200
|
|
|
193
201
|
// Fix outline border-radius for smaller buttons
|
|
@@ -96,12 +96,23 @@
|
|
|
96
96
|
}
|
|
97
97
|
|
|
98
98
|
.button.isSmall {
|
|
99
|
+
background: #fff;
|
|
100
|
+
border: 1px solid var(--color-gray-x-light);
|
|
99
101
|
border-radius: 16px;
|
|
100
102
|
font-size: 13px;
|
|
101
103
|
font-weight: var(--font-weight-regular);
|
|
102
104
|
height: auto; /* Match the non-module large button height instead of using fixed height of flex button */
|
|
103
105
|
line-height: 1;
|
|
104
106
|
padding: 6px 12px;
|
|
107
|
+
|
|
108
|
+
/* We set an explicit background on this button so we need more specificity on the hover style: */
|
|
109
|
+
@media (hover: hover) {
|
|
110
|
+
&:hover {
|
|
111
|
+
background-color: var(--color-button-default-hover-background);
|
|
112
|
+
border-color: var(--color-button-default-hover-border);
|
|
113
|
+
color: var(--color-button-default-text);
|
|
114
|
+
}
|
|
115
|
+
}
|
|
105
116
|
}
|
|
106
117
|
|
|
107
118
|
.button.isRoundRect {
|
|
@@ -29,8 +29,8 @@
|
|
|
29
29
|
// ----------------------------------------------
|
|
30
30
|
@color-success-light: #d8f2e6;
|
|
31
31
|
@color-success: #008c48;
|
|
32
|
-
@color-danger-light: #
|
|
33
|
-
@color-danger: #
|
|
32
|
+
@color-danger-light: #f9ebee;
|
|
33
|
+
@color-danger: #89142e;
|
|
34
34
|
@color-warning-light: #f9e4de;
|
|
35
35
|
@color-warning: #de6a44;
|
|
36
36
|
@color-info-light: #d8edf5;
|
|
@@ -32,8 +32,8 @@
|
|
|
32
32
|
/* UI colors */
|
|
33
33
|
--color-success-light: #d8f2e6;
|
|
34
34
|
--color-success: #008c48;
|
|
35
|
-
--color-danger-light: #
|
|
36
|
-
--color-danger: #
|
|
35
|
+
--color-danger-light: #f9ebee;
|
|
36
|
+
--color-danger: #89142e;
|
|
37
37
|
--color-warning-light: #f9e4de;
|
|
38
38
|
--color-warning: #de6a44;
|
|
39
39
|
--color-info-light: #d8edf5;
|
|
@@ -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">
|
|
@@ -34,7 +34,7 @@ rich-text {
|
|
|
34
34
|
}
|
|
35
35
|
|
|
36
36
|
// override validation coloring
|
|
37
|
-
.c-
|
|
37
|
+
.c-font-selector__dropdown__input {
|
|
38
38
|
.c-rich-text & {
|
|
39
39
|
border-color: #bbb !important; /* stylelint-disable-line declaration-no-important */
|
|
40
40
|
}
|
|
@@ -45,6 +45,10 @@ rich-text {
|
|
|
45
45
|
padding-left: 8px;
|
|
46
46
|
}
|
|
47
47
|
|
|
48
|
+
.c-rich-text-font-container {
|
|
49
|
+
min-width: 140px;
|
|
50
|
+
}
|
|
51
|
+
|
|
48
52
|
// Color class overrides
|
|
49
53
|
.ql-color-\#e60000 { color: #e60000; }
|
|
50
54
|
.ql-color-\#ff9900 { color: #f90; }
|
|
@@ -14,6 +14,7 @@ export default class RichTextComponentController implements ng.IComponentControl
|
|
|
14
14
|
protected allowColorSelection?: boolean
|
|
15
15
|
protected allowFontSelection?: boolean
|
|
16
16
|
protected fontStyle?: FontFamilyStyle
|
|
17
|
+
protected fontSelectorId: string
|
|
17
18
|
protected isRequired: boolean
|
|
18
19
|
protected requiredText: string
|
|
19
20
|
protected selectedColor: string
|
|
@@ -55,6 +56,7 @@ export default class RichTextComponentController implements ng.IComponentControl
|
|
|
55
56
|
this.requiredText = this.translateFactory.instant('JSUI.REQUIRED')
|
|
56
57
|
this.selectedColor = this.DEFAULT_COLOR
|
|
57
58
|
this.selectedFont = this.DEFAULT_FONT
|
|
59
|
+
this.fontSelectorId = 'rteFontSelector' + Math.floor(Math.random() * 1000 + 1)
|
|
58
60
|
|
|
59
61
|
this.colorPicker = document.getElementById('rteColorInput')
|
|
60
62
|
this.colorPicker.addEventListener('change', this.colorChanged.bind(this))
|
|
@@ -109,15 +111,15 @@ export default class RichTextComponentController implements ng.IComponentControl
|
|
|
109
111
|
this.applyColor()
|
|
110
112
|
}
|
|
111
113
|
|
|
112
|
-
protected fontSelected(
|
|
113
|
-
if (
|
|
114
|
+
protected fontSelected(fontFamily: string): void {
|
|
115
|
+
if (fontFamily) {
|
|
114
116
|
|
|
115
117
|
this.$rootScope.$broadcast('richTextToolbarContainer:closeContainer')
|
|
116
118
|
const fontAtributor = Quill.import('attributors/style/font')
|
|
117
|
-
fontAtributor.whitelist = [
|
|
118
|
-
this.updateFontDisplay(
|
|
119
|
+
fontAtributor.whitelist = [fontFamily]
|
|
120
|
+
this.updateFontDisplay(fontFamily)
|
|
119
121
|
Quill.register(fontAtributor, true)
|
|
120
|
-
this.editor.format('font',
|
|
122
|
+
this.editor.format('font', fontFamily)
|
|
121
123
|
|
|
122
124
|
this.sanitizeContents()
|
|
123
125
|
}
|