slate-vue3 0.0.1
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.md +21 -0
- package/README.md +101 -0
- package/dist/1.woff2 +0 -0
- package/dist/favicon.ico +0 -0
- package/dist/slate-vue3.d.ts +2825 -0
- package/dist/slate-vue3.js +12528 -0
- package/dist/slate-vue3.umd.cjs +12532 -0
- package/package.json +76 -0
package/License.md
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2024 Guan-Erjia
|
|
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.
|
package/README.md
ADDED
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
[<img src="https://raw.githubusercontent.com/ianstormtaylor/slate/main/docs/images/banner.png" />](https://github.com/ianstormtaylor/slate/raw/main/docs/images/banner.png)
|
|
2
|
+
|
|
3
|
+
<p align="center">
|
|
4
|
+
slate-<a style="color: #087ea4" href="https://react.dev/">react</a> library implemented with <a style="color: #42b883" href="https://vuejs.org/">vue</a>
|
|
5
|
+
</p>
|
|
6
|
+
<br/>
|
|
7
|
+
|
|
8
|
+
# Why use it?
|
|
9
|
+
|
|
10
|
+
1. Use vue internal response implementation to reduce the number of re-renderings
|
|
11
|
+
2. You can easily use vue-devtools to debug in a vue project
|
|
12
|
+
3. This library provides the same usage as slate-react
|
|
13
|
+
|
|
14
|
+
# Demo
|
|
15
|
+
|
|
16
|
+
Check out the [**live demo**](https://guan-erjia.github.io/slate-vue3/) of all of the examples
|
|
17
|
+
|
|
18
|
+
# Hooks
|
|
19
|
+
|
|
20
|
+
## [useComposing](https://github.com/Guan-Erjia/slate-vue3/blob/master/packages/slate-vue/src/hooks/use-composing.ts)
|
|
21
|
+
|
|
22
|
+
```
|
|
23
|
+
const useFocused: () => Ref<boolean, boolean>
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
Get the current composing state of the editor. It deals with compositionstart, compositionupdate, compositionend events.
|
|
27
|
+
|
|
28
|
+
Composition events are triggered by typing (composing) with a language that uses a composition character (e.g. Chinese, Japanese, Korean, etc.) example.
|
|
29
|
+
Some basic Git commands are:
|
|
30
|
+
|
|
31
|
+
## [useFocused](https://github.com/Guan-Erjia/slate-vue3/blob/master/packages/slate-vue/src/hooks/use-focus.ts)
|
|
32
|
+
|
|
33
|
+
```
|
|
34
|
+
const useFocused: () => Ref<boolean, boolean>
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
Get the current focused state of the editor.
|
|
38
|
+
|
|
39
|
+
## [useReadOnly](https://github.com/Guan-Erjia/slate-vue3/blob/master/packages/slate-vue/src/hooks/use-read-only.ts)
|
|
40
|
+
|
|
41
|
+
```
|
|
42
|
+
const useReadOnly: () => Ref<boolean, boolean>
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
Get the current readOnly state of the editor.
|
|
46
|
+
|
|
47
|
+
## [useSelected](https://github.com/Guan-Erjia/slate-vue3/blob/master/packages/slate-vue/src/hooks/use-selected.ts)
|
|
48
|
+
|
|
49
|
+
```
|
|
50
|
+
const useSelected: () => ComputedRef<boolean>
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
Get the current selected state of an element.
|
|
54
|
+
|
|
55
|
+
## [useEditor](https://github.com/Guan-Erjia/slate-vue3/blob/master/packages/slate-vue/src/hooks/use-editor.ts)
|
|
56
|
+
|
|
57
|
+
```
|
|
58
|
+
const useSlate: () => Editor;
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
Get the current editor object from the React context. Re-renders the context whenever changes occur in the editor.
|
|
62
|
+
|
|
63
|
+
## [useSelection](https://github.com/Guan-Erjia/slate-vue3/blob/master/packages/slate-vue/src/hooks/use-selection.ts)
|
|
64
|
+
|
|
65
|
+
```
|
|
66
|
+
const useSelection: () => ComputedRef<boolean>
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
Get the current editor selection from the React context.
|
|
70
|
+
|
|
71
|
+
# Packages
|
|
72
|
+
|
|
73
|
+
**slate's codebase is monorepo managed with pnpm workspace**
|
|
74
|
+
|
|
75
|
+
- [slate](https://github.com/Guan-Erjia/slate-vue3/tree/master/packages/slate)
|
|
76
|
+
slate core logic, update synchronously with slate
|
|
77
|
+
- [slate-dom](https://github.com/Guan-Erjia/slate-vue3/tree/master/packages/slate-dom)
|
|
78
|
+
Implementation of slate on dom, update synchronously with slate-dom
|
|
79
|
+
- [slate-vue](https://github.com/Guan-Erjia/slate-vue3/tree/master/packages/slate-vue)
|
|
80
|
+
Vue components for rendering slate editors
|
|
81
|
+
- [un-proxy-weakmap](https://github.com/Guan-Erjia/slate-vue3/tree/master/packages/un-proxy-weakmap)
|
|
82
|
+
for special processing of proxy type data, obtain the raw pointer
|
|
83
|
+
|
|
84
|
+
# compact files of slate
|
|
85
|
+
|
|
86
|
+
**reactive implement**
|
|
87
|
+
|
|
88
|
+
1. packages/slate/src/interfaces/text.ts 115:115
|
|
89
|
+
2. packages/slate/src/create-editor.ts 94:94
|
|
90
|
+
3. packages/slate/src/transforms-node/set-nodes.ts 18:18
|
|
91
|
+
|
|
92
|
+
**remove immer**
|
|
93
|
+
|
|
94
|
+
1. packages/slate/src/interfaces/node.ts 365:365
|
|
95
|
+
2. packages/slate/src/interfaces/point.ts 103:103
|
|
96
|
+
3. packages/slate/src/interfaces/range.ts 224:224
|
|
97
|
+
4. packages/slate/src/interfaces/transforms/general.ts 322:333
|
|
98
|
+
|
|
99
|
+
**rewrite implement for WeakMap**
|
|
100
|
+
|
|
101
|
+
1. packages/un-proxy-weakmap/src/index.ts
|
package/dist/1.woff2
ADDED
|
Binary file
|
package/dist/favicon.ico
ADDED
|
Binary file
|