@formulaxjs/editor 0.1.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/LICENSE ADDED
@@ -0,0 +1,35 @@
1
+ # MIT License
2
+
3
+ Copyright (c) 2024 FormulaX Contributors
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
22
+
23
+ ---
24
+
25
+ ## Legacy KityFormula Code
26
+
27
+ Portions of FormulaX, specifically within the `@formulaxjs/kity-runtime` package,
28
+ contain code adapted from [KityFormula](https://github.com/BaiduFE/kityformula)
29
+ by Baidu FEX Team, originally released under the MIT License.
30
+
31
+ KityFormula-related code in FormulaX is retained under the same MIT License
32
+ and is subject to the copyright notice above.
33
+
34
+ For details on the original KityFormula project, see:
35
+ https://github.com/BaiduFE/kityformula
package/README.md ADDED
@@ -0,0 +1,45 @@
1
+ # @formulaxjs/editor
2
+
3
+ Browser editing foundation for FormulaX.
4
+
5
+ `@formulaxjs/editor` adapts `@formulaxjs/core` state to the DOM. It provides the interactive editor shell, HTML rendering helpers, modal wiring, and browser-side styles used by richer host integrations.
6
+
7
+ > Status: experimental. Public APIs may change before the first stable release.
8
+
9
+ ## Install
10
+
11
+ ```bash
12
+ pnpm add @formulaxjs/editor @formulaxjs/core @formulaxjs/renderer @formulaxjs/kity-runtime
13
+ ```
14
+
15
+ ## Highlights
16
+
17
+ - `FormulaEditor` for mounting an interactive FormulaX editor into a DOM node
18
+ - `renderInteractiveHtml` for HTML rendering of FormulaX state
19
+ - `mountFormulaXKityEditor` for modal-based Kity editing flows
20
+ - `formulaXModalStyles` and `editorStyles` for default browser styling
21
+
22
+ ## Example
23
+
24
+ ```ts
25
+ import { FormulaEditor } from '@formulaxjs/editor';
26
+
27
+ const root = document.getElementById('editor');
28
+
29
+ if (!root) {
30
+ throw new Error('Missing #editor');
31
+ }
32
+
33
+ const editor = new FormulaEditor({
34
+ root,
35
+ onChange(state) {
36
+ console.log(state);
37
+ },
38
+ });
39
+
40
+ console.log(editor.getState());
41
+ ```
42
+
43
+ ## Package role
44
+
45
+ Use this package for browser-native FormulaX editing. If you are integrating FormulaX into TinyMCE, CKEditor 5, or Tiptap, prefer the dedicated adapter packages instead.