@formulaxjs/tinymce 0.2.0 → 0.3.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/README.md +73 -72
- package/README.zh-CN.md +56 -55
- package/dist/base.css +47 -0
- package/dist/canvg-runtime-UR3JNX5Q.js +2759 -0
- package/dist/canvg-runtime-UR3JNX5Q.js.map +1 -0
- package/dist/chunk-4NHESKRD.js +3407 -0
- package/dist/chunk-4NHESKRD.js.map +1 -0
- package/dist/images/scrollbar/custom/bar-bg.png +0 -0
- package/dist/images/scrollbar/custom/bar.png +0 -0
- package/dist/images/scrollbar/custom/bg.png +0 -0
- package/dist/images/scrollbar/custom/bottom.png +0 -0
- package/dist/images/scrollbar/custom/btn.png +0 -0
- package/dist/images/scrollbar/custom/down.png +0 -0
- package/dist/images/scrollbar/custom/top.png +0 -0
- package/dist/images/scrollbar/custom/up.png +0 -0
- package/dist/images/scrollbar/edit/bar-bg.png +0 -0
- package/dist/images/scrollbar/edit/bar-left.png +0 -0
- package/dist/images/scrollbar/edit/bar-right.png +0 -0
- package/dist/images/scrollbar/edit/thumb-bg.png +0 -0
- package/dist/images/scrollbar/edit/thumb-left.png +0 -0
- package/dist/images/scrollbar/edit/thumb-right.png +0 -0
- package/dist/images/toolbar/btn.png +0 -0
- package/dist/index.cjs +24136 -128
- package/dist/index.cjs.map +1 -1
- package/dist/index.global.js +294 -150
- package/dist/index.global.js.map +1 -1
- package/dist/index.js +3762 -21
- package/dist/index.js.map +1 -1
- package/dist/install-XGCSWTLU.js +5464 -0
- package/dist/install-XGCSWTLU.js.map +1 -0
- package/dist/install-XVTKACEN.js +1349 -0
- package/dist/install-XVTKACEN.js.map +1 -0
- package/dist/other.png +0 -0
- package/dist/scrollbar.css +78 -0
- package/dist/start-CRRRBVTN.js +4926 -0
- package/dist/start-CRRRBVTN.js.map +1 -0
- package/dist/ui.css +625 -0
- package/package.json +9 -4
- /package/dist/{KF_AMS_BB-5QF7FUSO.woff → KF_AMS_BB.woff} +0 -0
- /package/dist/{KF_AMS_CAL-NXRNLAZN.woff → KF_AMS_CAL.woff} +0 -0
- /package/dist/{KF_AMS_FRAK-CO33WWN4.woff → KF_AMS_FRAK.woff} +0 -0
- /package/dist/{KF_AMS_MAIN-25QJVAWY.woff → KF_AMS_MAIN.woff} +0 -0
- /package/dist/{KF_AMS_ROMAN-243BR7HH.woff → KF_AMS_ROMAN.woff} +0 -0
- /package/dist/{btn-5DANP6JY.png → btn.png} +0 -0
- /package/dist/{editor-JT5KLVXX.css → editor.css} +0 -0
- /package/dist/{other-OMWJFGL5.png → images/toolbar/other.png} +0 -0
package/README.md
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
# @formulaxjs/tinymce
|
|
2
2
|
|
|
3
|
-
English | [简体中文](
|
|
3
|
+
English | [简体中文](https://github.com/vndmea/formulaX/blob/main/packages/tinymce/README.zh-CN.md)
|
|
4
4
|
|
|
5
5
|
TinyMCE integration adapter for FormulaX.
|
|
6
6
|
|
|
7
|
-
`@formulaxjs/tinymce` registers FormulaX as a TinyMCE plugin and provides a modal-based formula editing experience for inserting and updating formulas inside TinyMCE content.
|
|
7
|
+
`@formulaxjs/tinymce` registers FormulaX as a TinyMCE plugin and provides a modal-based formula editing experience for inserting and updating formulas inside TinyMCE content.
|
|
8
8
|
|
|
9
9
|
> Status: experimental. Public APIs may change before the first stable release.
|
|
10
10
|
|
|
@@ -14,14 +14,14 @@ TinyMCE integration adapter for FormulaX.
|
|
|
14
14
|
- FormulaX toolbar button and menu item support
|
|
15
15
|
- `FormulaXOpen` TinyMCE command for programmatic opening
|
|
16
16
|
- Insert and update formulas as non-editable inline nodes
|
|
17
|
-
- Double-click, Enter, and Space editing interactions for existing formulas
|
|
18
|
-
- TinyMCE compatibility layer for versions `>=5 <9`
|
|
19
|
-
- LaTeX persistence through `data-formulax-latex`
|
|
20
|
-
- Markup helpers for creating, parsing, serializing, finding, and replacing formula elements
|
|
21
|
-
- Default read-only rendering through `@formulaxjs/renderer-kity`
|
|
22
|
-
- Optional runtime preload before the first modal open
|
|
23
|
-
|
|
24
|
-
## Compatibility
|
|
17
|
+
- Double-click, Enter, and Space editing interactions for existing formulas
|
|
18
|
+
- TinyMCE compatibility layer for versions `>=5 <9`
|
|
19
|
+
- LaTeX persistence through `data-formulax-latex`
|
|
20
|
+
- Markup helpers for creating, parsing, serializing, finding, and replacing formula elements
|
|
21
|
+
- Default read-only rendering through `@formulaxjs/renderer-kity`
|
|
22
|
+
- Optional runtime preload before the first modal open
|
|
23
|
+
|
|
24
|
+
## Compatibility
|
|
25
25
|
|
|
26
26
|
The package declares TinyMCE as an optional peer dependency:
|
|
27
27
|
|
|
@@ -40,8 +40,7 @@ The workspace demo can dynamically load TinyMCE 5, 6, 7, or 8 from CDN for compa
|
|
|
40
40
|
When the package is published:
|
|
41
41
|
|
|
42
42
|
```bash
|
|
43
|
-
|
|
44
|
-
pnpm add tinymce
|
|
43
|
+
npm install @formulaxjs/tinymce tinymce
|
|
45
44
|
```
|
|
46
45
|
|
|
47
46
|
Inside the FormulaX workspace, use the workspace package directly:
|
|
@@ -66,11 +65,12 @@ registerFormulaXTinyMcePlugin(tinymce, {
|
|
|
66
65
|
title: 'FormulaX Editor',
|
|
67
66
|
},
|
|
68
67
|
editor: {
|
|
68
|
+
locale: 'zh_CN', // optional, defaults to en_US
|
|
69
69
|
height: '100%',
|
|
70
70
|
autofocus: true,
|
|
71
71
|
render: { fontsize: 40 },
|
|
72
72
|
},
|
|
73
|
-
});
|
|
73
|
+
});
|
|
74
74
|
|
|
75
75
|
await tinymce.init({
|
|
76
76
|
selector: '#editor',
|
|
@@ -82,9 +82,9 @@ await tinymce.init({
|
|
|
82
82
|
});
|
|
83
83
|
```
|
|
84
84
|
|
|
85
|
-
Then users can click the `FormulaX` toolbar button to insert a formula. Existing formulas can be edited by double-clicking them or selecting them and pressing Enter or Space.
|
|
86
|
-
|
|
87
|
-
## Programmatic opening
|
|
85
|
+
Then users can click the `FormulaX` toolbar button to insert a formula. Existing formulas can be edited by double-clicking them or selecting them and pressing Enter or Space.
|
|
86
|
+
|
|
87
|
+
## Programmatic opening
|
|
88
88
|
|
|
89
89
|
The plugin registers the `FormulaXOpen` command:
|
|
90
90
|
|
|
@@ -135,77 +135,77 @@ if (isFormulaElement(element)) {
|
|
|
135
135
|
|
|
136
136
|
A generated formula node stores the source LaTeX in `data-formulax-latex` and is marked with `data-formulax="true"`:
|
|
137
137
|
|
|
138
|
-
```html
|
|
139
|
-
<span
|
|
140
|
-
class="formulax-math"
|
|
141
|
-
data-formulax="true"
|
|
142
|
-
data-formulax-latex="\\sqrt{x}"
|
|
143
|
-
data-latex="\\sqrt{x}"
|
|
144
|
-
contenteditable="false"
|
|
145
|
-
data-mce-contenteditable="false"
|
|
146
|
-
style="cursor: pointer"
|
|
147
|
-
></span>
|
|
148
|
-
```
|
|
149
|
-
|
|
150
|
-
The exact generated markup is internal and may evolve. Consumers should rely on the exported helper functions where possible.
|
|
151
|
-
|
|
152
|
-
## Custom renderer
|
|
153
|
-
|
|
154
|
-
The adapter accepts a `renderer` option. By default it uses `createKityFormulaRenderer()` from `@formulaxjs/renderer-kity`.
|
|
155
|
-
|
|
156
|
-
```ts
|
|
157
|
-
import tinymce from 'tinymce';
|
|
158
|
-
import { registerFormulaXTinyMcePlugin } from '@formulaxjs/tinymce';
|
|
159
|
-
import { createKityFormulaRenderer } from '@formulaxjs/renderer-kity';
|
|
160
|
-
|
|
161
|
-
registerFormulaXTinyMcePlugin(tinymce, {
|
|
162
|
-
renderer: createKityFormulaRenderer({
|
|
163
|
-
fontSize: 44,
|
|
164
|
-
}),
|
|
165
|
-
});
|
|
166
|
-
```
|
|
138
|
+
```html
|
|
139
|
+
<span
|
|
140
|
+
class="formulax-math"
|
|
141
|
+
data-formulax="true"
|
|
142
|
+
data-formulax-latex="\\sqrt{x}"
|
|
143
|
+
data-latex="\\sqrt{x}"
|
|
144
|
+
contenteditable="false"
|
|
145
|
+
data-mce-contenteditable="false"
|
|
146
|
+
style="cursor: pointer"
|
|
147
|
+
></span>
|
|
148
|
+
```
|
|
149
|
+
|
|
150
|
+
The exact generated markup is internal and may evolve. Consumers should rely on the exported helper functions where possible.
|
|
151
|
+
|
|
152
|
+
## Custom renderer
|
|
153
|
+
|
|
154
|
+
The adapter accepts a `renderer` option. By default it uses `createKityFormulaRenderer()` from `@formulaxjs/renderer-kity`.
|
|
155
|
+
|
|
156
|
+
```ts
|
|
157
|
+
import tinymce from 'tinymce';
|
|
158
|
+
import { registerFormulaXTinyMcePlugin } from '@formulaxjs/tinymce';
|
|
159
|
+
import { createKityFormulaRenderer } from '@formulaxjs/renderer-kity';
|
|
160
|
+
|
|
161
|
+
registerFormulaXTinyMcePlugin(tinymce, {
|
|
162
|
+
renderer: createKityFormulaRenderer({
|
|
163
|
+
fontSize: 44,
|
|
164
|
+
}),
|
|
165
|
+
});
|
|
166
|
+
```
|
|
167
167
|
|
|
168
168
|
## Options
|
|
169
169
|
|
|
170
170
|
```ts
|
|
171
|
-
interface FormulaXTinyMceOptions {
|
|
172
|
-
pluginName?: string;
|
|
173
|
-
buttonName?: string;
|
|
174
|
-
menuItemName?: string;
|
|
175
|
-
toolbarText?: string;
|
|
176
|
-
tooltip?: string;
|
|
177
|
-
cursorStyle?: string;
|
|
178
|
-
formulaClassName?: string;
|
|
179
|
-
formulaAttributeName?: string;
|
|
180
|
-
renderer?: FormulaRenderer;
|
|
181
|
-
preload?: FormulaXEditorPreloadMode;
|
|
182
|
-
initialLatex?: string;
|
|
183
|
-
modal?: FormulaXModalOptions;
|
|
184
|
-
editor?: FormulaXEditorOptions;
|
|
185
|
-
}
|
|
171
|
+
interface FormulaXTinyMceOptions {
|
|
172
|
+
pluginName?: string;
|
|
173
|
+
buttonName?: string;
|
|
174
|
+
menuItemName?: string;
|
|
175
|
+
toolbarText?: string;
|
|
176
|
+
tooltip?: string;
|
|
177
|
+
cursorStyle?: string;
|
|
178
|
+
formulaClassName?: string;
|
|
179
|
+
formulaAttributeName?: string;
|
|
180
|
+
renderer?: FormulaRenderer;
|
|
181
|
+
preload?: FormulaXEditorPreloadMode;
|
|
182
|
+
initialLatex?: string;
|
|
183
|
+
modal?: FormulaXModalOptions;
|
|
184
|
+
editor?: FormulaXEditorOptions;
|
|
185
|
+
}
|
|
186
186
|
```
|
|
187
187
|
|
|
188
188
|
| Option | Default | Description |
|
|
189
189
|
| --- | --- | --- |
|
|
190
190
|
| `pluginName` | `formulax` | TinyMCE plugin name registered through `tinymce.PluginManager.add`. |
|
|
191
191
|
| `buttonName` | `formulax` | Toolbar button name. |
|
|
192
|
-
| `menuItemName` | `formulax` | Menu item name. |
|
|
193
|
-
| `toolbarText` | `FormulaX` | Toolbar and menu item label. |
|
|
194
|
-
| `tooltip` | `Insert formula` | Toolbar button tooltip. |
|
|
195
|
-
| `cursorStyle` | `pointer` | Cursor style applied to generated formula nodes. |
|
|
196
|
-
| `formulaClassName` | `formulax-math` | CSS class used by generated formula nodes. |
|
|
197
|
-
| `formulaAttributeName` | `data-formulax-latex` | Attribute used to persist source LaTeX. |
|
|
198
|
-
| `renderer` | `createKityFormulaRenderer()` | Renderer used when the plugin needs runtime formula HTML. |
|
|
199
|
-
| `preload` | `idle` | Preloads the FormulaX runtime on browser idle, on host hover/focus, or never. |
|
|
200
|
-
| `initialLatex` | empty string | Initial LaTeX when inserting a new formula. |
|
|
201
|
-
| `modal` | see below | Modal labels, dimensions, and closing behavior. |
|
|
202
|
-
| `editor` | see below | Embedded FormulaX editor options. |
|
|
192
|
+
| `menuItemName` | `formulax` | Menu item name. |
|
|
193
|
+
| `toolbarText` | `FormulaX` | Toolbar and menu item label. |
|
|
194
|
+
| `tooltip` | `Insert formula` | Toolbar button tooltip. |
|
|
195
|
+
| `cursorStyle` | `pointer` | Cursor style applied to generated formula nodes. |
|
|
196
|
+
| `formulaClassName` | `formulax-math` | CSS class used by generated formula nodes. |
|
|
197
|
+
| `formulaAttributeName` | `data-formulax-latex` | Attribute used to persist source LaTeX. |
|
|
198
|
+
| `renderer` | `createKityFormulaRenderer()` | Renderer used when the plugin needs runtime formula HTML. |
|
|
199
|
+
| `preload` | `idle` | Preloads the FormulaX runtime on browser idle, on host hover/focus, or never. |
|
|
200
|
+
| `initialLatex` | empty string | Initial LaTeX when inserting a new formula. |
|
|
201
|
+
| `modal` | see below | Modal labels, dimensions, and closing behavior. |
|
|
202
|
+
| `editor` | see below | Embedded FormulaX editor options. |
|
|
203
203
|
|
|
204
204
|
### Modal options
|
|
205
205
|
|
|
206
206
|
| Option | Default | Description |
|
|
207
207
|
| --- | --- | --- |
|
|
208
|
-
| `title` | `FormulaX` | Modal title. |
|
|
208
|
+
| `title` | `FormulaX Editor` | Modal title. |
|
|
209
209
|
| `insertText` | `Insert` | Submit button text when inserting. |
|
|
210
210
|
| `updateText` | `Update` | Submit button text when updating. |
|
|
211
211
|
| `cancelText` | `Cancel` | Cancel button text. |
|
|
@@ -219,6 +219,7 @@ interface FormulaXTinyMceOptions {
|
|
|
219
219
|
| --- | --- | --- |
|
|
220
220
|
| `height` | `100%` | Embedded editor height. |
|
|
221
221
|
| `autofocus` | `true` | Whether the embedded editor should autofocus. |
|
|
222
|
+
| `locale` | `en_US` | Localizes the modal defaults and the embedded Kity runtime UI. |
|
|
222
223
|
| `assets` | `{}` | Optional Kity runtime asset overrides. |
|
|
223
224
|
| `render.fontsize` | `40` | Formula render font size. |
|
|
224
225
|
|
package/README.zh-CN.md
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
# @formulaxjs/tinymce
|
|
2
2
|
|
|
3
|
-
[English](
|
|
3
|
+
[English](https://github.com/vndmea/formulaX/blob/main/packages/tinymce/README.md) | 简体中文
|
|
4
4
|
|
|
5
5
|
FormulaX 的 TinyMCE 集成适配器。
|
|
6
6
|
|
|
7
|
-
`@formulaxjs/tinymce` 会将 FormulaX 注册为 TinyMCE 插件,并提供基于弹窗的公式编辑体验,用于在 TinyMCE 内容中插入和更新公式。
|
|
7
|
+
`@formulaxjs/tinymce` 会将 FormulaX 注册为 TinyMCE 插件,并提供基于弹窗的公式编辑体验,用于在 TinyMCE 内容中插入和更新公式。
|
|
8
8
|
|
|
9
9
|
> 状态:实验阶段。在首个稳定版本发布前,公共 API 仍可能调整。
|
|
10
10
|
|
|
@@ -14,12 +14,12 @@ FormulaX 的 TinyMCE 集成适配器。
|
|
|
14
14
|
- 支持 FormulaX 工具栏按钮和菜单项
|
|
15
15
|
- 提供 `FormulaXOpen` TinyMCE 命令,便于代码中主动打开公式编辑器
|
|
16
16
|
- 将公式作为不可直接编辑的 inline 节点插入和更新
|
|
17
|
-
- 支持双击、Enter、Space 编辑已有公式
|
|
18
|
-
- 面向 TinyMCE `>=5 <9` 的兼容层
|
|
19
|
-
- 通过 `data-formulax-latex` 持久化 LaTeX 源内容
|
|
20
|
-
- 提供创建、解析、序列化、查找和替换公式元素的 markup 工具函数
|
|
21
|
-
- 默认通过 `@formulaxjs/renderer-kity` 完成只读渲染
|
|
22
|
-
- 支持在首次打开弹窗前预加载 runtime
|
|
17
|
+
- 支持双击、Enter、Space 编辑已有公式
|
|
18
|
+
- 面向 TinyMCE `>=5 <9` 的兼容层
|
|
19
|
+
- 通过 `data-formulax-latex` 持久化 LaTeX 源内容
|
|
20
|
+
- 提供创建、解析、序列化、查找和替换公式元素的 markup 工具函数
|
|
21
|
+
- 默认通过 `@formulaxjs/renderer-kity` 完成只读渲染
|
|
22
|
+
- 支持在首次打开弹窗前预加载 runtime
|
|
23
23
|
|
|
24
24
|
## 兼容性
|
|
25
25
|
|
|
@@ -40,8 +40,7 @@ FormulaX 的 TinyMCE 集成适配器。
|
|
|
40
40
|
包发布后可使用:
|
|
41
41
|
|
|
42
42
|
```bash
|
|
43
|
-
|
|
44
|
-
pnpm add tinymce
|
|
43
|
+
npm install @formulaxjs/tinymce tinymce
|
|
45
44
|
```
|
|
46
45
|
|
|
47
46
|
在 FormulaX 工作空间内,直接使用 workspace 包:
|
|
@@ -66,11 +65,12 @@ registerFormulaXTinyMcePlugin(tinymce, {
|
|
|
66
65
|
title: 'FormulaX 公式编辑器',
|
|
67
66
|
},
|
|
68
67
|
editor: {
|
|
68
|
+
locale: 'zh_CN', // 可选,默认 en_US
|
|
69
69
|
height: '100%',
|
|
70
70
|
autofocus: true,
|
|
71
71
|
render: { fontsize: 40 },
|
|
72
72
|
},
|
|
73
|
-
});
|
|
73
|
+
});
|
|
74
74
|
|
|
75
75
|
await tinymce.init({
|
|
76
76
|
selector: '#editor',
|
|
@@ -82,9 +82,9 @@ await tinymce.init({
|
|
|
82
82
|
});
|
|
83
83
|
```
|
|
84
84
|
|
|
85
|
-
之后用户可以点击 `FormulaX` 工具栏按钮插入公式。已有公式可以通过双击编辑,也可以选中后按 Enter 或 Space 编辑。
|
|
86
|
-
|
|
87
|
-
## 代码中主动打开
|
|
85
|
+
之后用户可以点击 `FormulaX` 工具栏按钮插入公式。已有公式可以通过双击编辑,也可以选中后按 Enter 或 Space 编辑。
|
|
86
|
+
|
|
87
|
+
## 代码中主动打开
|
|
88
88
|
|
|
89
89
|
插件会注册 `FormulaXOpen` 命令:
|
|
90
90
|
|
|
@@ -147,42 +147,42 @@ if (isFormulaElement(element)) {
|
|
|
147
147
|
></span>
|
|
148
148
|
```
|
|
149
149
|
|
|
150
|
-
具体生成的 HTML 结构属于内部实现,后续可能演进。业务侧应优先依赖导出的工具函数。
|
|
151
|
-
|
|
152
|
-
## 自定义 renderer
|
|
153
|
-
|
|
154
|
-
该适配器支持 `renderer` 配置项。默认值是来自 `@formulaxjs/renderer-kity` 的 `createKityFormulaRenderer()`。
|
|
155
|
-
|
|
156
|
-
```ts
|
|
157
|
-
import tinymce from 'tinymce';
|
|
158
|
-
import { registerFormulaXTinyMcePlugin } from '@formulaxjs/tinymce';
|
|
159
|
-
import { createKityFormulaRenderer } from '@formulaxjs/renderer-kity';
|
|
160
|
-
|
|
161
|
-
registerFormulaXTinyMcePlugin(tinymce, {
|
|
162
|
-
renderer: createKityFormulaRenderer({
|
|
163
|
-
fontSize: 44,
|
|
164
|
-
}),
|
|
165
|
-
});
|
|
166
|
-
```
|
|
150
|
+
具体生成的 HTML 结构属于内部实现,后续可能演进。业务侧应优先依赖导出的工具函数。
|
|
151
|
+
|
|
152
|
+
## 自定义 renderer
|
|
153
|
+
|
|
154
|
+
该适配器支持 `renderer` 配置项。默认值是来自 `@formulaxjs/renderer-kity` 的 `createKityFormulaRenderer()`。
|
|
155
|
+
|
|
156
|
+
```ts
|
|
157
|
+
import tinymce from 'tinymce';
|
|
158
|
+
import { registerFormulaXTinyMcePlugin } from '@formulaxjs/tinymce';
|
|
159
|
+
import { createKityFormulaRenderer } from '@formulaxjs/renderer-kity';
|
|
160
|
+
|
|
161
|
+
registerFormulaXTinyMcePlugin(tinymce, {
|
|
162
|
+
renderer: createKityFormulaRenderer({
|
|
163
|
+
fontSize: 44,
|
|
164
|
+
}),
|
|
165
|
+
});
|
|
166
|
+
```
|
|
167
167
|
|
|
168
168
|
## 配置项
|
|
169
169
|
|
|
170
170
|
```ts
|
|
171
|
-
interface FormulaXTinyMceOptions {
|
|
172
|
-
pluginName?: string;
|
|
173
|
-
buttonName?: string;
|
|
174
|
-
menuItemName?: string;
|
|
175
|
-
toolbarText?: string;
|
|
176
|
-
tooltip?: string;
|
|
177
|
-
cursorStyle?: string;
|
|
178
|
-
formulaClassName?: string;
|
|
179
|
-
formulaAttributeName?: string;
|
|
180
|
-
renderer?: FormulaRenderer;
|
|
181
|
-
preload?: FormulaXEditorPreloadMode;
|
|
182
|
-
initialLatex?: string;
|
|
183
|
-
modal?: FormulaXModalOptions;
|
|
184
|
-
editor?: FormulaXEditorOptions;
|
|
185
|
-
}
|
|
171
|
+
interface FormulaXTinyMceOptions {
|
|
172
|
+
pluginName?: string;
|
|
173
|
+
buttonName?: string;
|
|
174
|
+
menuItemName?: string;
|
|
175
|
+
toolbarText?: string;
|
|
176
|
+
tooltip?: string;
|
|
177
|
+
cursorStyle?: string;
|
|
178
|
+
formulaClassName?: string;
|
|
179
|
+
formulaAttributeName?: string;
|
|
180
|
+
renderer?: FormulaRenderer;
|
|
181
|
+
preload?: FormulaXEditorPreloadMode;
|
|
182
|
+
initialLatex?: string;
|
|
183
|
+
modal?: FormulaXModalOptions;
|
|
184
|
+
editor?: FormulaXEditorOptions;
|
|
185
|
+
}
|
|
186
186
|
```
|
|
187
187
|
|
|
188
188
|
| 配置项 | 默认值 | 说明 |
|
|
@@ -192,20 +192,20 @@ interface FormulaXTinyMceOptions {
|
|
|
192
192
|
| `menuItemName` | `formulax` | 菜单项名。 |
|
|
193
193
|
| `toolbarText` | `FormulaX` | 工具栏按钮和菜单项显示文本。 |
|
|
194
194
|
| `tooltip` | `Insert formula` | 工具栏按钮 tooltip。 |
|
|
195
|
-
| `cursorStyle` | `pointer` | 应用于生成公式节点的鼠标光标样式。 |
|
|
196
|
-
| `formulaClassName` | `formulax-math` | 生成的公式节点 CSS class。 |
|
|
197
|
-
| `formulaAttributeName` | `data-formulax-latex` | 用于保存 LaTeX 源内容的属性。 |
|
|
198
|
-
| `renderer` | `createKityFormulaRenderer()` | 插件在需要运行时公式 HTML 时使用的 renderer。 |
|
|
199
|
-
| `preload` | `idle` | 控制在浏览器空闲时、宿主 hover/focus 时,或完全不预加载 FormulaX runtime。 |
|
|
200
|
-
| `initialLatex` | 空字符串 | 插入新公式时的初始 LaTeX。 |
|
|
201
|
-
| `modal` | 见下方 | 弹窗标题、按钮文本、尺寸和关闭行为。 |
|
|
202
|
-
| `editor` | 见下方 | 内嵌 FormulaX 编辑器配置。 |
|
|
195
|
+
| `cursorStyle` | `pointer` | 应用于生成公式节点的鼠标光标样式。 |
|
|
196
|
+
| `formulaClassName` | `formulax-math` | 生成的公式节点 CSS class。 |
|
|
197
|
+
| `formulaAttributeName` | `data-formulax-latex` | 用于保存 LaTeX 源内容的属性。 |
|
|
198
|
+
| `renderer` | `createKityFormulaRenderer()` | 插件在需要运行时公式 HTML 时使用的 renderer。 |
|
|
199
|
+
| `preload` | `idle` | 控制在浏览器空闲时、宿主 hover/focus 时,或完全不预加载 FormulaX runtime。 |
|
|
200
|
+
| `initialLatex` | 空字符串 | 插入新公式时的初始 LaTeX。 |
|
|
201
|
+
| `modal` | 见下方 | 弹窗标题、按钮文本、尺寸和关闭行为。 |
|
|
202
|
+
| `editor` | 见下方 | 内嵌 FormulaX 编辑器配置。 |
|
|
203
203
|
|
|
204
204
|
### Modal 配置
|
|
205
205
|
|
|
206
206
|
| 配置项 | 默认值 | 说明 |
|
|
207
207
|
| --- | --- | --- |
|
|
208
|
-
| `title` | `FormulaX` | 弹窗标题。 |
|
|
208
|
+
| `title` | `FormulaX Editor` | 弹窗标题。 |
|
|
209
209
|
| `insertText` | `Insert` | 插入公式时的提交按钮文本。 |
|
|
210
210
|
| `updateText` | `Update` | 更新公式时的提交按钮文本。 |
|
|
211
211
|
| `cancelText` | `Cancel` | 取消按钮文本。 |
|
|
@@ -219,6 +219,7 @@ interface FormulaXTinyMceOptions {
|
|
|
219
219
|
| --- | --- | --- |
|
|
220
220
|
| `height` | `100%` | 内嵌编辑器高度。 |
|
|
221
221
|
| `autofocus` | `true` | 内嵌编辑器是否自动聚焦。 |
|
|
222
|
+
| `locale` | `en_US` | 同时切换弹窗默认文案和内嵌 Kity runtime UI。 |
|
|
222
223
|
| `assets` | `{}` | 可选的 Kity runtime 资源覆盖配置。 |
|
|
223
224
|
| `render.fontsize` | `40` | 公式渲染字号。 |
|
|
224
225
|
|
package/dist/base.css
ADDED
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
|
|
2
|
+
.kf-editor {
|
|
3
|
+
width: 100%;
|
|
4
|
+
height: 100%;
|
|
5
|
+
display: flex;
|
|
6
|
+
flex-direction: column;
|
|
7
|
+
border: 1px solid #e0e0e0;
|
|
8
|
+
position: relative;
|
|
9
|
+
top: 0;
|
|
10
|
+
left: 0;
|
|
11
|
+
|
|
12
|
+
overflow: visible;
|
|
13
|
+
z-index: 2;
|
|
14
|
+
background-color: #f6f5ee;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
.kf-editor-edit-area {
|
|
18
|
+
width: 100%;
|
|
19
|
+
position: relative;
|
|
20
|
+
top: 0;
|
|
21
|
+
left: 0;
|
|
22
|
+
|
|
23
|
+
display: block;
|
|
24
|
+
z-index: 1;
|
|
25
|
+
flex: 1 1 auto;
|
|
26
|
+
min-height: 100px;
|
|
27
|
+
height: 100px;
|
|
28
|
+
overflow: hidden;
|
|
29
|
+
background-color: white;
|
|
30
|
+
/*background-color: white;*/
|
|
31
|
+
/*background-size: 21px 21px;*/
|
|
32
|
+
/*background-position: 0 0,10px 10px;*/
|
|
33
|
+
/*background-image: -webkit-linear-gradient(45deg,#efefef 25%,transparent 25%,transparent 75%,#efefef 75%,#efefef),-webkit-linear-gradient(45deg,#efefef 25%,transparent 25%,transparent 75%,#efefef 75%,#efefef);*/
|
|
34
|
+
/*background-image: linear-gradient(45deg,#efefef 25%,transparent 25%,transparent 75%,#efefef 75%,#efefef),linear-gradient(45deg,#efefef 25%,transparent 25%,transparent 75%,#efefef 75%,#efefef);*/
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
.kf-editor-canvas-container {
|
|
38
|
+
width: 100%;
|
|
39
|
+
height: 100%;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
.kf-editor-input-box {
|
|
43
|
+
position: fixed;
|
|
44
|
+
top: 0;
|
|
45
|
+
left: -99999999px;
|
|
46
|
+
z-index: 999999;
|
|
47
|
+
}
|