how to remove onFocus border from editorcontainer? already tried with getEditorContainerArea() #560
Unanswered
mukul-sharma085
asked this question in
Q&A
Replies: 1 comment
-
You can remove the onFocus border by overriding the default style used by tinyMCE on this exact class:
.tox .tox-edit-area::before {
border: 2px solid #006ce7; #this is the border style made on the onfocus!
}
.tox .tox-edit-area::before {
border-color: transparent !important;
} |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
`/* eslint-disable */
// @ts-nocheck
'use client';
import { useRef, useState } from 'react';
import { Editor } from '@tinymce/tinymce-react';
import { Editor as TinyMCEEditorType } from 'tinymce';
import { useTheme } from 'next-themes';
interface CustomEditorProps {
content: string;
onContentChange: (content: string) => void;
height?: number;
isPost?: boolean;
}
export const CustomEditor: React.FC = ({
content,
onContentChange,
height = 300,
}) => {
const editorRef = useRef<TinyMCEEditorType | null>(null);
const [isLoading, setIsLoading] = useState(true);
const [charCount, setCharCount] = useState(0);
const { theme } = useTheme();
const MAX_CHAR_LIMIT = 500;
const handleInit = (_evt: any, editor: TinyMCEEditorType) => {
editorRef.current = editor;
const initialLength = editor.getContent({ format: 'text' }).length;
setCharCount(initialLength);
if (initialLength > MAX_CHAR_LIMIT) {
const allowedText = editor
.getContent({ format: 'text' })
.slice(0, MAX_CHAR_LIMIT);
editor.setContent(allowedText);
onContentChange(allowedText);
setCharCount(MAX_CHAR_LIMIT);
}
setIsLoading(false);
};
const handleEditorChange = (
newContent: string,
editor: TinyMCEEditorType
) => {
const textContent = editor.getContent({ format: 'text' });
const length = textContent.trimStart().length;
if (length <= MAX_CHAR_LIMIT) {
onContentChange(newContent);
setCharCount(length);
} else {
const allowedText = textContent.slice(0, MAX_CHAR_LIMIT);
editor.setContent(allowedText);
onContentChange(allowedText);
setCharCount(MAX_CHAR_LIMIT);
}
};
const handleBeforeAddUndo = (evt: any, editor: TinyMCEEditorType) => {
const length = editor.getContent({ format: 'text' }).length;
if (length > MAX_CHAR_LIMIT) {
evt.preventDefault();
}
};
const getEditorTheme = () => {
return theme === 'dark'
? { skin: 'oxide-dark', content_css: 'dark' }
: { skin: 'bootstrap', content_css: 'tinymce-5' };
};
return (
{isLoading && (
)}
);
};
` can anyone answer please. skin used > const getEditorTheme = () => {
return theme === 'dark'
? { skin: 'oxide-dark', content_css: 'dark' }
: { skin: 'bootstrap', content_css: 'tinymce-5' };
};
Beta Was this translation helpful? Give feedback.
All reactions