Skip to content

Commit

Permalink
fix(icons): fix close icon
Browse files Browse the repository at this point in the history
Link Dialog Modal Close Button is not using the specified icon library

fix #130
  • Loading branch information
iliyaZelenko committed Feb 19, 2020
1 parent 8a0d3c3 commit b6e29cd
Show file tree
Hide file tree
Showing 6 changed files with 28 additions and 6 deletions.
2 changes: 1 addition & 1 deletion demo/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ MAIN_MODULE.then(({ TiptapVuetifyPlugin }) => {
})
Vue.use(TiptapVuetifyPlugin, {
vuetify,
iconsGroup: 'mdiSvg' // VuetifyIconsGroups (fa, md, mdi, mdiSvg)
iconsGroup: 'mdi' // VuetifyIconsGroups (fa, md, mdi, mdiSvg)
})

Vue.config.productionTip = false
Expand Down
2 changes: 1 addition & 1 deletion demo/pages/Index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@
min-height="500"
max-height="600"
:editor-properties="editorProperties"
output-format="json"
-->
<tiptap-vuetify
v-model="content"
:extensions="extensions"
placeholder="Write something …"
output-format="json"
@keydown="onkeydown"
/>

Expand Down
4 changes: 2 additions & 2 deletions plan.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
TODO: не включать не нужные иконки в бандл. Например, позволять пользователю импортировать нужные ему иконки, но не забыть что сторонние плагины должны иметь возможность включать иконки.

TODO идея по тому что ниже: импортировать иконки из @mdi/js если используется mdiSvg, только тогда. У пользователя должен быть установлен @mdi/js.
TODO не включать не нужные иконки в бандл. Например, позволять пользователю импортировать нужные ему иконки, но не забыть что сторонние плагины должны иметь возможность включать иконки.
Написать гайд как добавлять свои расширения и менять уже существующие.

Важно:
Expand Down
16 changes: 16 additions & 0 deletions src/configs/theme.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,27 @@
import VuetifyIcon from '~/extensions/nativeExtensions/icons/VuetifyIcon'

export const enum VuetifyIconsGroups {
// default icons in vuetify (official material design icons)
md = 'md',
mdi = 'mdi',
fa = 'fa',
/*
Для получения mdiSvg иконки, можно в RunKit запустить код:
const js = require("@mdi/js")
console.log(js.mdiClose)
*/
mdiSvg = 'mdiSvg'
}

export default {
defaultIconsGroup: VuetifyIconsGroups.md
}

export const COMMON_ICONS = {
close: {
[VuetifyIconsGroups.md]: new VuetifyIcon('close'),
[VuetifyIconsGroups.fa]: new VuetifyIcon('fas fa-times'),
[VuetifyIconsGroups.mdi]: new VuetifyIcon('mdi-close'),
[VuetifyIconsGroups.mdiSvg]: new VuetifyIcon('M19,6.41L17.59,5L12,10.59L6.41,5L5,6.41L10.59,12L5,17.59L6.41,19L12,13.41L17.59,19L19,17.59L13.41,12L19,6.41Z')
}
}
5 changes: 4 additions & 1 deletion src/extensions/nativeExtensions/image/ImageWindow.vue
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
icon
@click="close"
>
<v-icon>close</v-icon>
<v-icon>{{ COMMON_ICONS.close[$tiptapVuetify.iconsGroup] }}</v-icon>
</v-btn>
</v-card-title>
<v-card-text>
Expand Down Expand Up @@ -93,6 +93,7 @@ import { VRow, VCol, VImg, VDialog, VCard, VCardTitle, VCardText, VCardActions,
import I18nMixin from '~/mixins/I18nMixin'
import ImageUploadArea from '~/extensions/nativeExtensions/image/ImageUploadArea.vue'
import { VExpandTransition } from 'vuetify/lib/components/transitions'
import { COMMON_ICONS } from '~/configs/theme'
export const PROPS = {
VALUE: 'value' as const,
Expand Down Expand Up @@ -129,6 +130,8 @@ export default class ImageWindow extends mixins(I18nMixin) {
})
readonly [PROPS.EDITOR]: any
readonly COMMON_ICONS = COMMON_ICONS
form: {
src: null | string
} = {
Expand Down
5 changes: 4 additions & 1 deletion src/extensions/nativeExtensions/link/LinkWindow.vue
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
icon
@click="close"
>
<v-icon>close</v-icon>
<v-icon>{{ COMMON_ICONS.close[$tiptapVuetify.iconsGroup] }}</v-icon>
</v-btn>
</v-card-title>
<v-card-text>
Expand Down Expand Up @@ -57,6 +57,7 @@ import { mixins } from 'vue-class-component'
import { Component, Prop } from 'vue-property-decorator'
import { VDialog, VCard, VCardTitle, VCardText, VCardActions, VBtn, VSpacer, VIcon, VTextField } from 'vuetify/lib'
import I18nMixin from '~/mixins/I18nMixin'
import { COMMON_ICONS } from '~/configs/theme'
export const PROPS = {
VALUE: 'value' as const,
Expand Down Expand Up @@ -99,6 +100,8 @@ export default class LinkWindow extends mixins(I18nMixin) {
})
readonly [PROPS.HREF]: null | string
readonly COMMON_ICONS = COMMON_ICONS
form = {
href: this[PROPS.HREF],
blank: false
Expand Down

0 comments on commit b6e29cd

Please sign in to comment.