From b162119f80a785885a546e231a689e4e22b1ee71 Mon Sep 17 00:00:00 2001 From: wxik Date: Mon, 3 Apr 2023 18:26:15 +0800 Subject: [PATCH 1/7] fix: github build error --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 57af9b6..6bb2d63 100644 --- a/README.md +++ b/README.md @@ -176,7 +176,7 @@ export default FontFamilyStylesheet; import FontFamilyStylesheet from 'stylesheet.js'; ``` 5. Reload the app. You should now be seeing your Rich Editor content in your custom font face! From 21231c48de2469b3b1a4233ed631883d17499fcc Mon Sep 17 00:00:00 2001 From: wxik Date: Mon, 3 Apr 2023 18:31:32 +0800 Subject: [PATCH 2/7] fix: github build error --- README.md | 3 ++- examples/src/example.tsx | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 6bb2d63..3bd7d01 100644 --- a/README.md +++ b/README.md @@ -175,8 +175,9 @@ export default FontFamilyStylesheet; ```javascript import FontFamilyStylesheet from 'stylesheet.js'; +const fontFamily = 'Your_Font_Family'; ``` 5. Reload the app. You should now be seeing your Rich Editor content in your custom font face! diff --git a/examples/src/example.tsx b/examples/src/example.tsx index 0f05ba9..35c89ca 100644 --- a/examples/src/example.tsx +++ b/examples/src/example.tsx @@ -313,7 +313,7 @@ export function Example(props: IProps) { initialFocus={false} firstFocusEnd={false} disabled={disabled} - editorStyle={contentStyle} // default light style + editorStyle={{initialCSSText: `${1}`, contentCSSText: `font-family: ${Your_Font_Family}`}} // default light style ref={richText} style={styles.rich} useContainer={true} From c4c6b358cd11bd3d993f5100ea4ef34eb327653e Mon Sep 17 00:00:00 2001 From: wxik Date: Mon, 3 Apr 2023 18:32:50 +0800 Subject: [PATCH 3/7] fix: github build error --- examples/src/example.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/examples/src/example.tsx b/examples/src/example.tsx index 35c89ca..e09db2a 100644 --- a/examples/src/example.tsx +++ b/examples/src/example.tsx @@ -4,7 +4,7 @@ * @author wxik * @since 2019-06-24 14:52 */ -import React, {useCallback, useEffect, useMemo, useRef, useState} from 'react'; +import {useCallback, useEffect, useMemo, useRef, useState} from 'react'; import { Appearance, Button, @@ -313,7 +313,7 @@ export function Example(props: IProps) { initialFocus={false} firstFocusEnd={false} disabled={disabled} - editorStyle={{initialCSSText: `${1}`, contentCSSText: `font-family: ${Your_Font_Family}`}} // default light style + editorStyle={contentStyle} // default light style ref={richText} style={styles.rich} useContainer={true} From 459726abd2b5965c61948fd0633d6fdcfa778740 Mon Sep 17 00:00:00 2001 From: wxik Date: Mon, 3 Apr 2023 18:41:23 +0800 Subject: [PATCH 4/7] fix: github build error --- README.md | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 3bd7d01..e1bca41 100644 --- a/README.md +++ b/README.md @@ -176,9 +176,8 @@ export default FontFamilyStylesheet; import FontFamilyStylesheet from 'stylesheet.js'; const fontFamily = 'Your_Font_Family'; - +const initialCSSText = { initialCSSText: `${FontFamilyStylesheet}`, contentCSSText: `font-family: ${fontFamily}` } + ``` 5. Reload the app. You should now be seeing your Rich Editor content in your custom font face! From edc124f54fc9312c715e5bb9ab4dc4239db88fa6 Mon Sep 17 00:00:00 2001 From: wxik Date: Mon, 3 Apr 2023 18:44:41 +0800 Subject: [PATCH 5/7] fix: github build error --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index e1bca41..bdc6d87 100644 --- a/README.md +++ b/README.md @@ -312,7 +312,7 @@ const TempScreen = () => { (H1), }} + iconMap={{ [actions.heading1]: ({tintColor}) => (H1) }} /> ); From dc33ed906e60fd1ac7d85ace8c6fca001b069b2b Mon Sep 17 00:00:00 2001 From: wxik Date: Mon, 3 Apr 2023 18:48:07 +0800 Subject: [PATCH 6/7] fix: github build error --- README.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index bdc6d87..34d4db1 100644 --- a/README.md +++ b/README.md @@ -293,6 +293,8 @@ import React from "react"; import { Text, Platform, KeyboardAvoidingView, SafeAreaView, ScrollView } from "react-native"; import {actions, RichEditor, RichToolbar} from "react-native-pell-rich-editor"; + +const handleHead = ({tintColor}) => H1 const TempScreen = () => { const richText = React.useRef(); return ( @@ -312,7 +314,7 @@ const TempScreen = () => { (H1) }} + iconMap={{ [actions.heading1]: handleHead }} /> ); From 5cdc67f14dc5838303e6470ade02e48eac7f3ca9 Mon Sep 17 00:00:00 2001 From: Gevorg Gasparyan Date: Mon, 3 Apr 2023 15:48:29 +0400 Subject: [PATCH 7/7] feat: Add injectJavascript method --- index.d.ts | 2 ++ src/RichEditor.js | 4 ++++ 2 files changed, 6 insertions(+) diff --git a/index.d.ts b/index.d.ts index 6158e88..d49234f 100644 --- a/index.d.ts +++ b/index.d.ts @@ -199,6 +199,8 @@ export class RichEditor extends React.Component { insertHTML: (html: string) => void; + injectJavascript: (type: string) => void; + preCode: (type: string) => void; /** diff --git a/src/RichEditor.js b/src/RichEditor.js index 9c8d4a6..abfee30 100755 --- a/src/RichEditor.js +++ b/src/RichEditor.js @@ -379,6 +379,10 @@ export default class RichTextEditor extends Component { } } + injectJavascript(script) { + return this.webviewBridge.injectJavaScript(script); + } + preCode(type) { this.sendAction(actions.code, 'result', type); }