diff --git a/demo/src/index.js b/demo/src/index.js index a3e5270..011e3c1 100644 --- a/demo/src/index.js +++ b/demo/src/index.js @@ -103,164 +103,164 @@ const Demo = () => { }; return ( - - -
+
+ + console.log("OnChange: ", val)} onSave={onSave} /> -
- } onClick={showDrawer} /> - } - placement="right" - onClose={onClose} - open={open} - > - - - setConfiguration((e) => ({ ...e, richText: checked })) - } - /> - - setConfiguration((e) => ({ ...e, format: value })) - } - options={[ - { - value: "raw", - label: "Raw", - }, - { - value: "markdown", - label: "Markdown", - }, - ]} - /> - - - setConfiguration((e) => ({ - ...e, - toolbar: { ...e.toolbar, showAlignment: checked }, - })) - } - /> - - setConfiguration((e) => ({ - ...e, - toolbar: { ...e.toolbar, showUndoRedo: checked }, - })) - } - /> - - setConfiguration((e) => ({ - ...e, - toolbar: { ...e.toolbar, showBlockFormat: checked }, - })) - } - /> - - setConfiguration((e) => ({ - ...e, - toolbar: { ...e.toolbar, showInsert: checked }, - })) - } - /> - - setConfiguration((e) => ({ - ...e, - toolbar: { ...e.toolbar, showFontFormat: checked }, - })) - } - /> - - setConfiguration((e) => ({ - ...e, - toolbar: { ...e.toolbar, showExtraFormat: checked }, - })) - } - /> - - setConfiguration((e) => ({ - ...e, - toolbar: { ...e.toolbar, showInsertLink: checked }, - })) - } - /> - - - setConfiguration((e) => ({ - ...e, - spellchecker: { ...e.spellchecker, enabled: checked }, - })) - } - /> - - - - - - + } onClick={showDrawer} /> + } + placement="right" + onClose={onClose} + open={open} + > + + + setConfiguration((e) => ({ ...e, richText: checked })) + } + /> + + setConfiguration((e) => ({ ...e, format: value })) + } + options={[ + { + value: "raw", + label: "Raw", + }, + { + value: "markdown", + label: "Markdown", + }, + ]} + /> + + + setConfiguration((e) => ({ + ...e, + toolbar: { ...e.toolbar, showAlignment: checked }, + })) + } + /> + + setConfiguration((e) => ({ + ...e, + toolbar: { ...e.toolbar, showUndoRedo: checked }, + })) + } + /> + + setConfiguration((e) => ({ + ...e, + toolbar: { ...e.toolbar, showBlockFormat: checked }, + })) + } + /> + + setConfiguration((e) => ({ + ...e, + toolbar: { ...e.toolbar, showInsert: checked }, + })) + } + /> + + setConfiguration((e) => ({ + ...e, + toolbar: { ...e.toolbar, showFontFormat: checked }, + })) + } + /> + + setConfiguration((e) => ({ + ...e, + toolbar: { ...e.toolbar, showExtraFormat: checked }, + })) + } + /> + + setConfiguration((e) => ({ + ...e, + toolbar: { ...e.toolbar, showInsertLink: checked }, + })) + } + /> + + + setConfiguration((e) => ({ + ...e, + spellchecker: { ...e.spellchecker, enabled: checked }, + })) + } + /> + + + + + + +
); }; diff --git a/src/index.js b/src/index.js index f387fea..8e44513 100644 --- a/src/index.js +++ b/src/index.js @@ -128,25 +128,61 @@ export default ({ }, [isSmallWidthViewport]); return ( - - {configuration.richText && ( - - )} -
- {configuration.richText ? ( - <> - -
- +
+ + {configuration.richText && ( + + )} +
+ {configuration.richText ? ( + <> + +
+ +
-
- } + } + placeholder={ + + {configuration.placeholder ?? locale.resources.placeholder} + + } + ErrorBoundary={LexicalErrorBoundary} + /> + + + + + + {floatingAnchorElem && !isSmallWidthViewport && ( + <> + + + + + )} + + ) : ( + } placeholder={ {configuration.placeholder ?? locale.resources.placeholder} @@ -154,61 +190,27 @@ export default ({ } ErrorBoundary={LexicalErrorBoundary} /> - - - - - - {floatingAnchorElem && !isSmallWidthViewport && ( - <> - - - - - )} - - ) : ( - } - placeholder={ - - {configuration.placeholder ?? locale.resources.placeholder} - + )} + + + - )} - - - - - {configuration.format == "markdown" && ( - - )} -
- + + {configuration.format == "markdown" && ( + + )} +
+
+ ); }; diff --git a/src/styles.css b/src/styles.css index 67f4b41..1908155 100644 --- a/src/styles.css +++ b/src/styles.css @@ -49,7 +49,11 @@ code { max-width: 1100px; min-height: 300px; color: #000; - position: relative; + position: absolute; + top: 0; + bottom: 0; + left: 0; + right: 0; line-height: 1.7; font-weight: 400; display: flex; @@ -59,7 +63,10 @@ code { .editorShell .editor-container { background: #fff; position: relative; - display: block; + flex-grow: 1; + display: flex; + flex-direction: column; + align-items: stretch; border-bottom-left-radius: 10px; border-bottom-right-radius: 10px; } @@ -76,6 +83,7 @@ code { .editorScroller { min-height: 150px; border: 0; + flex-grow: 1; display: flex; position: relative; outline: 0;