Skip to content

Commit 2e0e14b

Browse files
committed
fix(fluent-editor): fix font/size/line-height whitelist
1 parent 4c1a628 commit 2e0e14b

File tree

2 files changed

+43
-6
lines changed

2 files changed

+43
-6
lines changed

packages/renderless/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@opentiny/vue-renderless",
3-
"version": "3.18.3",
3+
"version": "3.18.4",
44
"private": true,
55
"description": "An enterprise-class UI component library, support both Vue.js 2 and Vue.js 3, as well as PC and mobile.",
66
"author": "OpenTiny Team",

packages/renderless/src/fluent-editor/options.ts

Lines changed: 42 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,42 @@
11
import { isNull } from '../common/type'
22

3+
const fontFamilyConfig = [
4+
'songti',
5+
'yahei',
6+
'kaiti',
7+
'heiti',
8+
'lishu',
9+
'mono',
10+
'arial',
11+
'arialblack',
12+
'comic',
13+
'impact',
14+
'times'
15+
]
16+
17+
const fontSizeConfig = [
18+
'12px',
19+
'13px',
20+
'14px',
21+
'15px',
22+
'16px',
23+
'17px',
24+
'18px',
25+
'19px',
26+
'20px',
27+
'22px',
28+
'24px',
29+
'26px',
30+
'29px',
31+
'32px',
32+
'36px',
33+
'40px',
34+
'48px',
35+
'72px'
36+
]
37+
38+
const lineHeightConfig = ['1', '1.2', '1.5', '2', '2.5', '3', '4', '5']
39+
340
const betterTable = {
441
operationMenu: {
542
items: {
@@ -20,7 +57,7 @@ const betterTable = {
2057
}
2158
}
2259

23-
const toolbar = (FluentEditor) => {
60+
const toolbar = () => {
2461
const underline = ['bold', 'italic', 'underline', 'strike']
2562
const list = [{ list: 'ordered' }, { list: 'bullet' }]
2663
const script = [{ script: 'sub' }, { script: 'super' }]
@@ -29,9 +66,9 @@ const toolbar = (FluentEditor) => {
2966
container: [
3067
['undo', 'redo', 'clean'],
3168
[
32-
{ font: FluentEditor.imports['formats/font'].whitelist },
33-
{ size: FluentEditor.imports['formats/size'].whitelist },
34-
{ lineheight: FluentEditor.imports['formats/lineheight'].whitelist },
69+
{ font: fontFamilyConfig },
70+
{ size: fontSizeConfig },
71+
{ lineheight: lineHeightConfig },
3572
{ header: [1, 2, 3, 4, 5, 6, false] }
3673
],
3774
underline,
@@ -170,7 +207,7 @@ const defaultOption = ({ FluentEditor, state, mentionObj }) => {
170207
file: true, // 上传文件需开启
171208
image: FluentEditor.imports['modules/image-spec'],
172209
counter: false,
173-
toolbar: toolbar(FluentEditor),
210+
toolbar: toolbar(),
174211
'better-table': betterTable,
175212
mention: mention(mentionObj),
176213
keyboard: keyboard({ FluentEditor, state })

0 commit comments

Comments
 (0)