diff --git a/admin/src/components/Input/components/CKEReact.jsx b/admin/src/components/Input/components/CKEReact.jsx
index cb02925..20ef11e 100644
--- a/admin/src/components/Input/components/CKEReact.jsx
+++ b/admin/src/components/Input/components/CKEReact.jsx
@@ -11,15 +11,15 @@ export const CKEReact = ({
disabled,
maxLength,
preset,
+ isMaxLength,
+ setIsMaxLength,
setEditorInstance,
}) => {
const { onChange: fieldOnChange, value, error } = useField(name);
- const [lengthMax, setLengthMax] = useState(false);
-
const wordCounter = useRef(null);
- const handleCounter = (number) => setLengthMax(number > maxLength);
+ const handleCounter = (number) => setIsMaxLength(number > maxLength);
const hasWordCountPlugin = Boolean(preset.editorConfig.WordCountPlugin);
@@ -63,7 +63,7 @@ export const CKEReact = ({
/>
{hasWordCountPlugin && (
)}
diff --git a/admin/src/components/Input/components/Editor.jsx b/admin/src/components/Input/components/Editor.jsx
index 1a1643a..d5c4a76 100644
--- a/admin/src/components/Input/components/Editor.jsx
+++ b/admin/src/components/Input/components/Editor.jsx
@@ -16,9 +16,10 @@ export const Editor = ({
maxLength,
placeholder,
}) => {
- const [mediaLibVisible, setMediaLibVisible] = useState(false);
- const [editorInstance, setEditorInstance] = useState(false);
+ const [editorInstance, setEditorInstance] = useState(null);
const [preset, setPreset] = useState(null);
+ const [isMaxLength, setIsMaxLength] = useState(false);
+ const [mediaLibVisible, setMediaLibVisible] = useState(false);
const toggleMediaLib = () => setMediaLibVisible((prev) => !prev);
@@ -52,12 +53,18 @@ export const Editor = ({
return (
<>
-
+
{
+export const EditorLayout = ({ children, presetStyles, name, isMaxLength }) => {
+ const { error } = useField(name);
const [isExpandedMode, setIsExpandedMode] = useState(false);
const handleToggleExpand = () => setIsExpandedMode(true);
@@ -46,13 +54,12 @@ export const EditorLayout = ({ children, presetStyles }) => {
{children}
-
+
@@ -65,7 +72,11 @@ export const EditorLayout = ({ children, presetStyles }) => {
}
return (
-
+
{children}
@@ -77,7 +88,31 @@ export const EditorLayout = ({ children, presetStyles }) => {
const EditorWrapper = styled('div')`
position: relative;
width: 100%;
- height: 100%;
+ height: ${({ $isExpanded }) => ($isExpanded ? '100%' : 'auto')};
+ border-radius: ${({ theme }) => theme.borderRadius};
+
+ ${({ theme, $hasError = false, $isExpanded }) => css`
+ outline: none;
+ box-shadow: 0;
+ transition-property: border-color, box-shadow, fill;
+ transition-duration: 0.2s;
+ border: 1px solid
+ ${({ theme, $hasError }) =>
+ $hasError ? theme.colors.danger600 : theme.colors.neutral200};
+ border-radius: ${({ theme }) => theme.borderRadius};
+
+ &:focus-within {
+ border: 1px solid
+ ${$hasError ? theme.colors.danger600
+ : $isExpanded ? theme.colors.neutral200
+ : theme.colors.primary600};
+
+ box-shadow: ${$hasError ?
+ theme.colors.danger600
+ : theme.colors.primary600}
+ 0px 0px 0px 2px;
+ }
+ `}
${({ $presetStyles }) => $presetStyles}
`;
@@ -102,5 +137,5 @@ const CollapseButton = styled(IconButton)`
`;
const FullScreenBox = styled(Box)`
- max-width: var(--ck-editor-full-screen-box-max-width);
-`
\ No newline at end of file
+ max-width: var(--ck-editor-full-screen-box-max-width);
+`;
diff --git a/admin/src/components/Input/theme/common.js b/admin/src/components/Input/theme/common.js
index 8d55938..3e3e9b2 100644
--- a/admin/src/components/Input/theme/common.js
+++ b/admin/src/components/Input/theme/common.js
@@ -146,12 +146,16 @@ const plugin = css`
}
}
+ .ck.ck-editor__top .ck-sticky-panel .ck-sticky-panel__content{
+ border: none !important;
+ }
+
.ck.ck-editor__main {
min-height: var(--ck-editor-min-height) !important;
max-height: var(--ck-editor-max-height) !important;
overflow-y: auto;
overflow-x: hidden;
- border: 1px solid var(--ck-color-base-border);
+ border-top: 1px solid var(--ck-color-base-border);
border-bottom-left-radius: var(--ck-border-radius);
border-bottom-right-radius: var(--ck-border-radius);
}
@@ -276,9 +280,6 @@ const expanded = css`
min-height: none !important;
max-height: none !important;
overflow-y: scroll !important;
- border: 1px solid var(--ck-color-base-border);
- border-bottom-left-radius: var(--ck-border-radius);
- border-bottom-right-radius: var(--ck-border-radius);
padding: calc(2 * var(--ck-spacing-large));
}