From 2f5593202e6e5bbb89c97e418ff241e340d6ea0c Mon Sep 17 00:00:00 2001 From: abanobmikaeel Date: Fri, 6 Oct 2023 09:51:03 -0400 Subject: [PATCH] Explicitly deleting existing document --- package.json | 2 +- src/index.tsx | 10 ++++------ 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/package.json b/package.json index f1f61cf..3bec999 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "react-native-ckeditor-custom", - "version": "0.3.6", + "version": "0.3.7", "description": "A react native library to handle custom ckeditors", "main": "lib/commonjs/index", "module": "lib/module/index", diff --git a/src/index.tsx b/src/index.tsx index e19221a..4c7c054 100644 --- a/src/index.tsx +++ b/src/index.tsx @@ -23,7 +23,6 @@ interface CKEditorProps { colors?: any; toolbarBorderSize?: string; editorFocusBorderSize?: string; - // placeHolderText?: string; onLoadEnd?: any; injectedJavascript?: string; } @@ -45,7 +44,6 @@ export const CKEditor5 = ({ colors, toolbarBorderSize, editorFocusBorderSize, - // placeHolderText, onLoadEnd, injectedJavascript, }: CKEditorProps) => { @@ -75,6 +73,10 @@ export const CKEditor5 = ({ if (webviewRef) { webviewRef.injectJavaScript( `element.removeEventListener("cleanupLater", cleanupLater, true); + const editorElement = document.querySelector('#editor1'); + if (editorElement) { + editorElement.parentNode.removeChild(editorElement); + } true;` ); webviewRef?.stopLoading(); @@ -82,9 +84,6 @@ export const CKEditor5 = ({ }; }, []); - const navigationStateChanged = () => { - console.log('state changed'); - }; const injectedJS = ` window.onload = function() { ClassicEditor.create( document.querySelector( '#editor1' ), ${JSON.stringify( @@ -204,7 +203,6 @@ export const CKEditor5 = ({ onMessage={onMessage} renderLoading={renderLoading} mixedContentMode="always" - onNavigationStateChange={navigationStateChanged} automaticallyAdjustContentInsets={false} />