Skip to content

Commit 5c90303

Browse files
webnoobrstoenescu
authored andcommitted
feat(QEditor) Allow icon overrides. Fixes quasarframework#5163 (quasarframework#5164)
* feat (ui): QSlider / QRange allow null value quasarframework#4637 * Update Null.vue * Update Null.vue * Update QSlider.js * feat (QEditor): Allow header and size icons to be overridden. Fixes: 5163 * chore (git): Fix merged file issues. * chore (git): Fix merged file issues. * Update quasar-icon-sets.md
1 parent ca7f551 commit 5c90303

File tree

4 files changed

+51
-14
lines changed

4 files changed

+51
-14
lines changed

docs/src/pages/options/quasar-icon-sets.md

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ framework: {
5151
This will enable you to use both Ionicons & Fontawesome in your app, and all Quasar components will display Fontawesome icons.
5252

5353
#### Changing Icon Set Dynamically
54-
Quasar Icon Set is reactive, so all components will update properly if you change the $q.iconSet object. Here is a example:
54+
Quasar Icon Set is reactive, so all components will update properly if you change the $q.iconSet object. Here is an example:
5555

5656
```js
5757
methods: {
@@ -61,6 +61,17 @@ methods: {
6161
}
6262
```
6363

64+
#### Changing a Specific Icon Dynamically
65+
If you want to change a specific icon to another, you can. Here is an example:
66+
67+
```js
68+
methods: {
69+
changeQEditorHeaderIcon () {
70+
this.$q.iconSet.editor.header1 = 'fas fa-font'
71+
}
72+
}
73+
```
74+
6475
### UMD Way
6576
Include the Quasar Icon Set tag for your Quasar version and also tell Quasar to use it. Example:
6677

ui/icon-set/mdi-v3.js

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,8 +68,21 @@ export default {
6868
undo: 'mdi-undo',
6969
redo: 'mdi-redo',
7070
header: 'mdi-format-size',
71+
header1: 'mdi-format-header-1',
72+
header2: 'mdi-format-header-2',
73+
header3: 'mdi-format-header-3',
74+
header4: 'mdi-format-header-4',
75+
header5: 'mdi-format-header-5',
76+
header6: 'mdi-format-header-6',
7177
code: 'mdi-code-tags',
7278
size: 'mdi-format-size',
79+
size1: 'mdi-numeric-1-box',
80+
size2: 'mdi-numeric-2-box',
81+
size3: 'mdi-numeric-3-box',
82+
size4: 'mdi-numeric-4-box',
83+
size5: 'mdi-numeric-5-box',
84+
size6: 'mdi-numeric-6-box',
85+
size7: 'mdi-numeric-7-box',
7386
font: 'mdi-format-font'
7487
},
7588
expansionItem: {

ui/icon-set/mdi-v4.js

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,8 +68,21 @@ export default {
6868
undo: 'mdi-undo',
6969
redo: 'mdi-redo',
7070
header: 'mdi-format-size',
71+
header1: 'mdi-format-header-1',
72+
header2: 'mdi-format-header-2',
73+
header3: 'mdi-format-header-3',
74+
header4: 'mdi-format-header-4',
75+
header5: 'mdi-format-header-5',
76+
header6: 'mdi-format-header-6',
7177
code: 'mdi-code-tags',
7278
size: 'mdi-format-size',
79+
size1: 'mdi-numeric-1-box',
80+
size2: 'mdi-numeric-2-box',
81+
size3: 'mdi-numeric-3-box',
82+
size4: 'mdi-numeric-4-box',
83+
size5: 'mdi-numeric-5-box',
84+
size6: 'mdi-numeric-6-box',
85+
size7: 'mdi-numeric-7-box',
7386
font: 'mdi-format-font'
7487
},
7588
expansionItem: {

ui/src/components/editor/QEditor.js

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -124,22 +124,22 @@ export default Vue.extend({
124124
undo: { type: 'no-state', cmd: 'undo', icon: i.undo, tip: e.undo, key: 90 },
125125
redo: { type: 'no-state', cmd: 'redo', icon: i.redo, tip: e.redo, key: 89 },
126126

127-
h1: { cmd: 'formatBlock', param: 'H1', icon: i.header, tip: e.header1, htmlTip: `<h1 class="q-ma-none">${e.header1}</h1>` },
128-
h2: { cmd: 'formatBlock', param: 'H2', icon: i.header, tip: e.header2, htmlTip: `<h2 class="q-ma-none">${e.header2}</h2>` },
129-
h3: { cmd: 'formatBlock', param: 'H3', icon: i.header, tip: e.header3, htmlTip: `<h3 class="q-ma-none">${e.header3}</h3>` },
130-
h4: { cmd: 'formatBlock', param: 'H4', icon: i.header, tip: e.header4, htmlTip: `<h4 class="q-ma-none">${e.header4}</h4>` },
131-
h5: { cmd: 'formatBlock', param: 'H5', icon: i.header, tip: e.header5, htmlTip: `<h5 class="q-ma-none">${e.header5}</h5>` },
132-
h6: { cmd: 'formatBlock', param: 'H6', icon: i.header, tip: e.header6, htmlTip: `<h6 class="q-ma-none">${e.header6}</h6>` },
127+
h1: { cmd: 'formatBlock', param: 'H1', icon: i.header1 || i.header, tip: e.header1, htmlTip: `<h1 class="q-ma-none">${e.header1}</h1>` },
128+
h2: { cmd: 'formatBlock', param: 'H2', icon: i.header2 || i.header, tip: e.header2, htmlTip: `<h2 class="q-ma-none">${e.header2}</h2>` },
129+
h3: { cmd: 'formatBlock', param: 'H3', icon: i.header3 || i.header, tip: e.header3, htmlTip: `<h3 class="q-ma-none">${e.header3}</h3>` },
130+
h4: { cmd: 'formatBlock', param: 'H4', icon: i.header4 || i.header, tip: e.header4, htmlTip: `<h4 class="q-ma-none">${e.header4}</h4>` },
131+
h5: { cmd: 'formatBlock', param: 'H5', icon: i.header5 || i.header, tip: e.header5, htmlTip: `<h5 class="q-ma-none">${e.header5}</h5>` },
132+
h6: { cmd: 'formatBlock', param: 'H6', icon: i.header6 || i.header, tip: e.header6, htmlTip: `<h6 class="q-ma-none">${e.header6}</h6>` },
133133
p: { cmd: 'formatBlock', param: 'DIV', icon: i.header, tip: e.paragraph },
134134
code: { cmd: 'formatBlock', param: 'PRE', icon: i.code, htmlTip: `<code>${e.code}</code>` },
135135

136-
'size-1': { cmd: 'fontSize', param: '1', icon: i.size, tip: e.size1, htmlTip: `<font size="1">${e.size1}</font>` },
137-
'size-2': { cmd: 'fontSize', param: '2', icon: i.size, tip: e.size2, htmlTip: `<font size="2">${e.size2}</font>` },
138-
'size-3': { cmd: 'fontSize', param: '3', icon: i.size, tip: e.size3, htmlTip: `<font size="3">${e.size3}</font>` },
139-
'size-4': { cmd: 'fontSize', param: '4', icon: i.size, tip: e.size4, htmlTip: `<font size="4">${e.size4}</font>` },
140-
'size-5': { cmd: 'fontSize', param: '5', icon: i.size, tip: e.size5, htmlTip: `<font size="5">${e.size5}</font>` },
141-
'size-6': { cmd: 'fontSize', param: '6', icon: i.size, tip: e.size6, htmlTip: `<font size="6">${e.size6}</font>` },
142-
'size-7': { cmd: 'fontSize', param: '7', icon: i.size, tip: e.size7, htmlTip: `<font size="7">${e.size7}</font>` }
136+
'size-1': { cmd: 'fontSize', param: '1', icon: i.size1 || i.size, tip: e.size1, htmlTip: `<font size="1">${e.size1}</font>` },
137+
'size-2': { cmd: 'fontSize', param: '2', icon: i.size2 || i.size, tip: e.size2, htmlTip: `<font size="2">${e.size2}</font>` },
138+
'size-3': { cmd: 'fontSize', param: '3', icon: i.size3 || i.size, tip: e.size3, htmlTip: `<font size="3">${e.size3}</font>` },
139+
'size-4': { cmd: 'fontSize', param: '4', icon: i.size4 || i.size, tip: e.size4, htmlTip: `<font size="4">${e.size4}</font>` },
140+
'size-5': { cmd: 'fontSize', param: '5', icon: i.size5 || i.size, tip: e.size5, htmlTip: `<font size="5">${e.size5}</font>` },
141+
'size-6': { cmd: 'fontSize', param: '6', icon: i.size6 || i.size, tip: e.size6, htmlTip: `<font size="6">${e.size6}</font>` },
142+
'size-7': { cmd: 'fontSize', param: '7', icon: i.size7 || i.size, tip: e.size7, htmlTip: `<font size="7">${e.size7}</font>` }
143143
}
144144
},
145145

0 commit comments

Comments
 (0)