@soul-refiner/design-system 0.2.25 → 0.2.26

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.
@@ -5,5 +5,7 @@ export interface EditorProps {
5
5
  editable: boolean;
6
6
  handleUploadImage: (files: FileList) => Promise<string>;
7
7
  onChange: (newNodes: TElement[]) => void;
8
+ previousContent?: TElement[];
8
9
  }
9
- export declare const Editor: ({ editable, handleUploadImage, onChange, }: EditorProps) => React.JSX.Element;
10
+ export type EditorContent = TElement;
11
+ export declare const Editor: ({ editable, handleUploadImage, onChange, previousContent, }: EditorProps) => React.JSX.Element;
@@ -9,8 +9,8 @@ import { blocks, inline, marks, utils } from './plugins';
9
9
  const plugins = createPlugins([...blocks, ...inline, ...marks, ...utils], {
10
10
  components: plateUI,
11
11
  });
12
- export const Editor = ({ editable, handleUploadImage, onChange, }) => {
13
- return (React.createElement(PlateProvider, { id: "main", initialValue: DEFAULT_CONTENT, onChange: onChange, plugins: plugins },
12
+ export const Editor = ({ editable, handleUploadImage, onChange, previousContent = DEFAULT_CONTENT, }) => {
13
+ return (React.createElement(PlateProvider, { id: "main", initialValue: previousContent, onChange: onChange, plugins: plugins },
14
14
  React.createElement(Wrapper, null,
15
15
  editable && React.createElement(EditorBar, { handleUploadImage: handleUploadImage }),
16
16
  React.createElement(Plate, { id: "main", editableProps: {
@@ -1,4 +1,4 @@
1
1
  export { Editor } from './editor';
2
- export type { EditorProps } from './editor';
2
+ export type { EditorProps, EditorContent } from './editor';
3
3
  export { SimpleEditor } from './simple_editor';
4
4
  export type { SimpleEditorProps } from './simple_editor';
@@ -6,5 +6,6 @@ export interface SimpleEditorProps {
6
6
  handleUploadImage: (files: FileList) => Promise<string>;
7
7
  onChange: (newNodes: TElement[]) => void;
8
8
  placeholder?: string;
9
+ previousContent?: TElement[];
9
10
  }
10
- export declare const SimpleEditor: ({ editable, handleUploadImage, onChange, placeholder, }: SimpleEditorProps) => React.JSX.Element;
11
+ export declare const SimpleEditor: ({ editable, handleUploadImage, onChange, placeholder, previousContent, }: SimpleEditorProps) => React.JSX.Element;
@@ -4,17 +4,17 @@ import styled from 'styled-components';
4
4
  import { Plate, PlateProvider } from '@udecode/plate';
5
5
  import { plugins } from './plugins';
6
6
  import { EditorBar } from './navbar';
7
- export const SimpleEditor = ({ editable, handleUploadImage, onChange, placeholder = '', }) => {
8
- return (React.createElement(PlateProvider, { id: "main", initialValue: [
7
+ export const SimpleEditor = ({ editable, handleUploadImage, onChange, placeholder = '', previousContent = [
8
+ {
9
+ type: 'p',
10
+ children: [
9
11
  {
10
- type: 'p',
11
- children: [
12
- {
13
- text: '',
14
- },
15
- ],
12
+ text: '',
16
13
  },
17
- ], onChange: onChange, plugins: plugins },
14
+ ],
15
+ },
16
+ ], }) => {
17
+ return (React.createElement(PlateProvider, { id: "main", initialValue: previousContent, onChange: onChange, plugins: plugins },
18
18
  React.createElement(Wrapper, null,
19
19
  editable && React.createElement(EditorBar, { handleUploadImage: handleUploadImage }),
20
20
  React.createElement(InnerWrapper, null,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@soul-refiner/design-system",
3
- "version": "0.2.25",
3
+ "version": "0.2.26",
4
4
  "main": "dist/index.js",
5
5
  "license": "MIT",
6
6
  "publishConfig": {