Skip to content

Commit

Permalink
Remove custom dirty state handling as it is not needed
Browse files Browse the repository at this point in the history
  • Loading branch information
agalin920 committed Feb 9, 2024
1 parent e0e6213 commit dc578e4
Showing 1 changed file with 4 additions and 8 deletions.
12 changes: 4 additions & 8 deletions src/shell/components/FieldTypeTinyMCE/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,6 @@ export const FieldTypeTinyMCE = React.memo(function FieldTypeTinyMCE({
// NOTE: controlled component
const [initialValue, setInitialValue] = useState(value);
const [isSkinLoaded, setIsSkinLoaded] = useState(false);
const [isDirty, setIsDirty] = useState(false);

// NOTE: update if version changes
useEffect(() => {
Expand Down Expand Up @@ -115,16 +114,13 @@ export const FieldTypeTinyMCE = React.memo(function FieldTypeTinyMCE({
onFocusOut={onBlur}
initialValue={initialValue}
onEditorChange={(content, editor) => {
if (isDirty) {
onChange(content, name, datatype);
onChange(content, name, datatype);

const charCount =
editor.plugins?.wordcount?.body?.getCharacterCount() ?? 0;
const charCount =
editor.plugins?.wordcount?.body?.getCharacterCount() ?? 0;

onCharacterCountChange(charCount);
}
onCharacterCountChange(charCount);
}}
onDirty={() => setIsDirty(true)}
onInit={(_, editor) => {
const charCount =
editor.plugins?.wordcount?.body?.getCharacterCount() ?? 0;
Expand Down

0 comments on commit dc578e4

Please sign in to comment.