Skip to content

Commit

Permalink
Explicitly deleting existing document
Browse files Browse the repository at this point in the history
  • Loading branch information
abanobmikaeel committed Oct 6, 2023
1 parent abb0c1d commit 2f55932
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 7 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -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",
Expand Down
10 changes: 4 additions & 6 deletions src/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ interface CKEditorProps {
colors?: any;
toolbarBorderSize?: string;
editorFocusBorderSize?: string;
// placeHolderText?: string;
onLoadEnd?: any;
injectedJavascript?: string;
}
Expand All @@ -45,7 +44,6 @@ export const CKEditor5 = ({
colors,
toolbarBorderSize,
editorFocusBorderSize,
// placeHolderText,
onLoadEnd,
injectedJavascript,
}: CKEditorProps) => {
Expand Down Expand Up @@ -75,16 +73,17 @@ 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();
}
};
}, []);

const navigationStateChanged = () => {
console.log('state changed');
};
const injectedJS = `
window.onload = function() {
ClassicEditor.create( document.querySelector( '#editor1' ), ${JSON.stringify(
Expand Down Expand Up @@ -204,7 +203,6 @@ export const CKEditor5 = ({
onMessage={onMessage}
renderLoading={renderLoading}
mixedContentMode="always"
onNavigationStateChange={navigationStateChanged}
automaticallyAdjustContentInsets={false}
/>
</SafeAreaView>
Expand Down

0 comments on commit 2f55932

Please sign in to comment.