Skip to content

Commit 0a51e16

Browse files
committed
feat(embed): use iconfont
1 parent 6ca9dcb commit 0a51e16

21 files changed

+42
-103
lines changed

.eslintignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
/dist
22
/src/css/katex
3+
/src/statics

src/components/QuasarTiptap.vue

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ import {
5353
import java from 'highlight.js/lib/languages/java'
5454
import javascript from 'highlight.js/lib/languages/javascript'
5555
import css from 'highlight.js/lib/languages/css'
56+
require('src/statics/iconfont/iconfont')
5657
5758
import {
5859
OTitle,

src/components/buttons/OEmbedMenu.vue

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,9 @@
77
<div class="row col-3" v-for="(service, j) of group.children" :key="`service-${i}-${j}`">
88
<q-item class="col-12" clickable v-close-popup @click="select(service)">
99
<q-item-section avatar>
10-
<img :src="`statics/service/${service.svgIcon}.svg`" v-if="service.svgIcon" />
10+
<svg class="icon" aria-hidden="true" v-if="service.svgIcon">
11+
<use :xlink:href="`#icon-${service.svgIcon}`"></use>
12+
</svg>
1113
<q-icon :name="service.icon || 'apps'" :color="service.color" v-else />
1214
</q-item-section>
1315
<q-item-section>

src/components/views/OEmbedView.vue

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,9 @@
1515
@paste.stop.native>
1616
<template v-slot:prepend>
1717
<div class="row items-center">
18-
<img :src="`statics/service/${service.svgIcon}.svg`" v-if="service.svgIcon" />
18+
<svg class="icon" aria-hidden="true" v-if="service.svgIcon">
19+
<use :xlink:href="`#icon-${service.svgIcon}`"></use>
20+
</svg>
1921
<q-icon :name="service.icon || 'apps'" :color="service.color" v-else />
2022
<q-tooltip anchor="top middle" self="bottom middle">{{$o.lang.embed[service.value]}}</q-tooltip>
2123
</div>

src/css/app.styl

Lines changed: 0 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -7,28 +7,3 @@
77
// --------------------------------------------------------------------------------
88
// Menu
99
// --------------------------------------------------------------------------------
10-
.o-menu {
11-
min-width 160px !important
12-
13-
.q-list {
14-
padding 8px 0
15-
.q-item {
16-
padding 8px 10px
17-
min-height unset
18-
}
19-
}
20-
21-
.q-item {
22-
min-height unset
23-
padding 4px 8px
24-
25-
.q-item__section--main {
26-
padding-left 8px
27-
}
28-
}
29-
30-
.q-avatar {
31-
width 2rem !important
32-
height 2rem !important
33-
}
34-
}

src/css/tiptap.styl

Lines changed: 32 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -516,36 +516,48 @@
516516
.q-btn, .q-tab {
517517
text-transform unset
518518
}
519+
520+
.icon {
521+
width: 24px;
522+
height: 24px;
523+
vertical-align: -0.15em;
524+
fill: currentColor;
525+
overflow: hidden;
526+
}
519527
}
520528

529+
521530
.o-menu {
522-
.q-item {
523-
.checked {
524-
visibility hidden
525-
}
526-
}
527-
.q-item.is-active {
528-
background rgba(0, 0, 0, 0.08)
531+
min-width 160px !important
529532

530-
.checked {
531-
visibility visible
533+
.q-list {
534+
padding 8px 0
535+
.q-item {
536+
padding 8px 10px
537+
min-height unset
532538
}
533539
}
534540

535-
.o-button {
536-
cursor pointer
537-
text-align center
538-
padding 4px 10px
539-
margin 0 4px
540-
background rgba(0, 0, 0, 0.05)
541-
border-radius 4px
541+
.q-item {
542+
min-height unset
543+
padding 4px 8px
542544

543-
.q-icon {
544-
font-size 1.2rem
545+
.q-item__section--main {
546+
padding-left 8px
545547
}
546548
}
547-
.o-button:hover {
548-
background rgba(0, 0, 0, 0.1)
549+
550+
.q-avatar {
551+
width 2rem !important
552+
height 2rem !important
553+
}
554+
555+
.icon {
556+
width: 24px;
557+
height: 24px;
558+
vertical-align: -0.15em;
559+
fill: currentColor;
560+
overflow: hidden;
549561
}
550562
}
551563

src/extentions/Embed.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
* @date 2020.04.29
77
*/
88
import { Node } from 'tiptap'
9-
import OEmbedView from 'components/views/OEmbedView'
9+
import OEmbedView from 'src/components/views/OEmbedView'
1010

1111
function getAttrs (dom) {
1212
const src = dom.getAttribute('src') || ''

src/statics/iconfont/iconfont.js

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/statics/service/amap.svg

Lines changed: 0 additions & 1 deletion
This file was deleted.

src/statics/service/baidu-map.svg

Lines changed: 0 additions & 1 deletion
This file was deleted.

0 commit comments

Comments
 (0)