Quellcode durchsuchen

dev: [SimpleEditor] add props: appendInnerBar and type both

Roxas vor 4 Jahren
Ursprung
Commit
d3f48e8597

+ 2
- 1
eslib/Editor/index.d.ts Datei anzeigen

@@ -11,12 +11,13 @@ interface ToolListItem {
11 11
     render?: (i: ToolListItem, innerIcon: any, innerText: any, divWrapStyle: React.CSSProperties | undefined) => any;
12 12
 }
13 13
 interface SimpleEditorProps extends BaseEditorProps {
14
-    toolAlign?: "inner" | "bottom";
14
+    toolAlign?: "inner" | "bottom" | "both";
15 15
     toolList?: Array<ToolListItem>;
16 16
     injectControlsToolBar?: any;
17 17
     injectBraftEditorProps?: any;
18 18
     toolBarContainerStyle?: any;
19 19
     appendToolBtn?: any;
20
+    appendInnderBar?: any;
20 21
 }
21 22
 declare const SimpleEditor: (props: SimpleEditorProps) => JSX.Element;
22 23
 export { default as BraftEditor } from "../BraftEditor/index";

+ 22
- 1
eslib/Editor/index.js Datei anzeigen

@@ -124,7 +124,9 @@ var SimpleEditor = function SimpleEditor(props) {
124 124
       _props$injectBraftEdi = props.injectBraftEditorProps,
125 125
       injectBraftEditorProps = _props$injectBraftEdi === void 0 ? {} : _props$injectBraftEdi,
126 126
       _props$appendToolBtn = props.appendToolBtn,
127
-      appendToolBtn = _props$appendToolBtn === void 0 ? null : _props$appendToolBtn;
127
+      appendToolBtn = _props$appendToolBtn === void 0 ? null : _props$appendToolBtn,
128
+      _props$appendInnderBa = props.appendInnderBar,
129
+      appendInnderBar = _props$appendInnderBa === void 0 ? null : _props$appendInnderBa;
128 130
 
129 131
   if (toolAlign === 'inner') {
130 132
     return React.createElement(BarftEditorPage, Object.assign({
@@ -143,6 +145,25 @@ var SimpleEditor = function SimpleEditor(props) {
143 145
     }, injectBraftEditorProps));
144 146
   }
145 147
 
148
+  if (toolAlign === 'both') {
149
+    return React.createElement("div", null, React.createElement(BarftEditorPage, Object.assign({
150
+      value: value,
151
+      onChange: onChange,
152
+      controls: [],
153
+      FloatControls: {
154
+        appendInnderBar: appendInnderBar
155
+      }
156
+    }, injectBraftEditorProps)), React.createElement("div", {
157
+      style: toolBarContainerStyle
158
+    }, React.createElement("div", {
159
+      className: styles.bottomToolBarWrapper
160
+    }, React.createElement(ControlsToolBar, Object.assign({
161
+      editorState: value,
162
+      setEditorState: onChange,
163
+      toolList: toolList
164
+    }, injectControlsToolBar))), appendToolBtn));
165
+  }
166
+
146 167
   return React.createElement("div", null, React.createElement(BarftEditorPage, Object.assign({
147 168
     value: value,
148 169
     onChange: onChange,

+ 1
- 1
eslib/Editor/index.js.map
Datei-Diff unterdrückt, da er zu groß ist
Datei anzeigen


+ 2
- 1
lib/Editor/index.d.ts Datei anzeigen

@@ -11,12 +11,13 @@ interface ToolListItem {
11 11
     render?: (i: ToolListItem, innerIcon: any, innerText: any, divWrapStyle: React.CSSProperties | undefined) => any;
12 12
 }
13 13
 interface SimpleEditorProps extends BaseEditorProps {
14
-    toolAlign?: "inner" | "bottom";
14
+    toolAlign?: "inner" | "bottom" | "both";
15 15
     toolList?: Array<ToolListItem>;
16 16
     injectControlsToolBar?: any;
17 17
     injectBraftEditorProps?: any;
18 18
     toolBarContainerStyle?: any;
19 19
     appendToolBtn?: any;
20
+    appendInnderBar?: any;
20 21
 }
21 22
 declare const SimpleEditor: (props: SimpleEditorProps) => JSX.Element;
22 23
 export { default as BraftEditor } from "../BraftEditor/index";

+ 22
- 1
lib/Editor/index.js Datei anzeigen

@@ -130,7 +130,9 @@ var SimpleEditor = function SimpleEditor(props) {
130 130
       _props$injectBraftEdi = props.injectBraftEditorProps,
131 131
       injectBraftEditorProps = _props$injectBraftEdi === void 0 ? {} : _props$injectBraftEdi,
132 132
       _props$appendToolBtn = props.appendToolBtn,
133
-      appendToolBtn = _props$appendToolBtn === void 0 ? null : _props$appendToolBtn;
133
+      appendToolBtn = _props$appendToolBtn === void 0 ? null : _props$appendToolBtn,
134
+      _props$appendInnderBa = props.appendInnderBar,
135
+      appendInnderBar = _props$appendInnderBa === void 0 ? null : _props$appendInnderBa;
134 136
 
135 137
   if (toolAlign === 'inner') {
136 138
     return React__default.createElement(BraftEditor$1.BarftEditorPage, Object.assign({
@@ -149,6 +151,25 @@ var SimpleEditor = function SimpleEditor(props) {
149 151
     }, injectBraftEditorProps));
150 152
   }
151 153
 
154
+  if (toolAlign === 'both') {
155
+    return React__default.createElement("div", null, React__default.createElement(BraftEditor$1.BarftEditorPage, Object.assign({
156
+      value: value,
157
+      onChange: onChange,
158
+      controls: [],
159
+      FloatControls: {
160
+        appendInnderBar: appendInnderBar
161
+      }
162
+    }, injectBraftEditorProps)), React__default.createElement("div", {
163
+      style: toolBarContainerStyle
164
+    }, React__default.createElement("div", {
165
+      className: styles.bottomToolBarWrapper
166
+    }, React__default.createElement(ControlsToolBar, Object.assign({
167
+      editorState: value,
168
+      setEditorState: onChange,
169
+      toolList: toolList
170
+    }, injectControlsToolBar))), appendToolBtn));
171
+  }
172
+
152 173
   return React__default.createElement("div", null, React__default.createElement(BraftEditor$1.BarftEditorPage, Object.assign({
153 174
     value: value,
154 175
     onChange: onChange,

+ 1
- 1
lib/Editor/index.js.map
Datei-Diff unterdrückt, da er zu groß ist
Datei anzeigen


+ 28
- 1
src/components/Editor/ImgTxtEditor/SimpleEditor.tsx Datei anzeigen

@@ -5,12 +5,13 @@ import { ContentUtils } from "braft-utils";
5 5
 import styles from './index.less';
6 6
 
7 7
 interface SimpleEditorProps extends BaseEditorProps {
8
-  toolAlign?: 'inner' | 'bottom';
8
+  toolAlign?: 'inner' | 'bottom' | 'both';
9 9
   toolList?: Array<ToolListItem>;
10 10
   injectControlsToolBar?: any;
11 11
   injectBraftEditorProps?: any;
12 12
   toolBarContainerStyle?: any;
13 13
   appendToolBtn?: any;
14
+  appendInnderBar?: any;
14 15
 }
15 16
 
16 17
 const SimpleEditor = (props: SimpleEditorProps) => {
@@ -23,6 +24,7 @@ const SimpleEditor = (props: SimpleEditorProps) => {
23 24
     toolBarContainerStyle = {},
24 25
     injectBraftEditorProps = {},
25 26
     appendToolBtn = null,
27
+    appendInnderBar = null,
26 28
   } = props;
27 29
 
28 30
 
@@ -45,6 +47,31 @@ const SimpleEditor = (props: SimpleEditorProps) => {
45 47
     )
46 48
   }
47 49
 
50
+  if (toolAlign === 'both') {
51
+    return (
52
+      <div>
53
+        <BarftEditorPage
54
+          value={value}
55
+          onChange={onChange}
56
+          controls={[]}
57
+          FloatControls={{appendInnderBar}}
58
+          {...injectBraftEditorProps}
59
+        />
60
+        <div style={toolBarContainerStyle}>
61
+          <div className={styles.bottomToolBarWrapper}>
62
+            <ControlsToolBar
63
+              editorState={value}
64
+              setEditorState={onChange}
65
+              toolList={toolList}
66
+              {...injectControlsToolBar}
67
+            />
68
+          </div>
69
+          {appendToolBtn}
70
+        </div>
71
+      </div>
72
+    )
73
+  }
74
+
48 75
   return (
49 76
     <div>
50 77
       <BarftEditorPage

+ 2
- 1
stats.html
Datei-Diff unterdrückt, da er zu groß ist
Datei anzeigen