x-star-editor 0.3.10 → 0.3.11

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.
@@ -21,6 +21,8 @@ export interface XStarMdEditorPlugin {
21
21
  export interface XStarMdEditorHandle {
22
22
  exec: Executor;
23
23
  getEditorContainer: () => HTMLDivElement;
24
+ getValue: () => string;
25
+ setValue: (value: string) => void;
24
26
  }
25
27
  export interface XStarMdEditorProps {
26
28
  /**
@@ -82,6 +82,26 @@ var XStarMdEditor = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
82
82
  exec: exec,
83
83
  getEditorContainer: function getEditorContainer() {
84
84
  return containerRef.current;
85
+ },
86
+ getValue: function getValue() {
87
+ return exec(function (_ref2) {
88
+ var sourceCode = _ref2.sourceCode;
89
+ return sourceCode;
90
+ });
91
+ },
92
+ setValue: function setValue(value) {
93
+ return exec(function (_ref3) {
94
+ var selection = _ref3.selection,
95
+ dispatch = _ref3.dispatch;
96
+ return dispatch({
97
+ type: 'set',
98
+ payload: {
99
+ sourceCode: value,
100
+ selection: selection
101
+ },
102
+ selection: selection
103
+ });
104
+ });
85
105
  }
86
106
  };
87
107
  }, []);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "x-star-editor",
3
- "version": "0.3.10",
3
+ "version": "0.3.11",
4
4
  "description": "An editor developed by turingstar",
5
5
  "license": "MIT",
6
6
  "module": "dist/index.js",