Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

adding initialCSSText option #111

Merged
merged 2 commits into from
Aug 24, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,7 @@ export interface RichEditorProps extends WebViewProps {
caretColor?: string; // cursor/selection color
placeholderColor?: string; // editor placeholder text color
contentCSSText?: string; // editor content css text
initialCSSText?: string; // editor global css initial text
cssText?: string; // editor global css text
};
}
Expand Down
4 changes: 3 additions & 1 deletion src/RichEditor.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,8 @@ export default class RichTextEditor extends Component {
that.layout = {};
that.selectionChangeListeners = [];
const {
editorStyle: {backgroundColor, color, placeholderColor, cssText, contentCSSText, caretColor} = {},
editorStyle: {backgroundColor, color, placeholderColor, initialCSSText, cssText, contentCSSText} = {},
editorStyle: {backgroundColor, color, placeholderColor, initialCSSText, cssText, contentCSSText, caretColor} = {},
html,
pasteAsPlainText,
onPaste,
Expand All @@ -74,6 +75,7 @@ export default class RichTextEditor extends Component {
color,
caretColor,
placeholderColor,
initialCSSText,
cssText,
contentCSSText,
pasteAsPlainText,
Expand Down
6 changes: 3 additions & 3 deletions src/editor.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ function createHTML(options = {}) {
placeholderColor = '#a9a9a9',
contentCSSText = '',
cssText = '',
initialCSSText = '',
pasteAsPlainText = false,
pasteListener = false,
keyDownListener = false,
Expand All @@ -45,12 +46,11 @@ function createHTML(options = {}) {
<title>RN Rich Text Editor</title>
<meta name="viewport" content="user-scalable=1.0,initial-scale=1.0,minimum-scale=1.0,maximum-scale=1.0">
<style>
${initialCSSText}
* {outline: 0px solid transparent;-webkit-tap-highlight-color: rgba(0,0,0,0);-webkit-touch-callout: none;box-sizing: border-box;}
html, body { margin: 0; padding: 0;font-family: Arial, Helvetica, sans-serif; font-size:1em; height: 100%}
body { overflow-y: hidden; -webkit-overflow-scrolling: touch;background-color: ${backgroundColor};caret-color: ${caretColor};}
.content {font-family: Arial, Helvetica, sans-serif;color: ${color}; width: 100%;${
!useContainer ? 'height:100%;' : ''
}-webkit-overflow-scrolling: touch;padding-left: 0;padding-right: 0;}
.content {font-family: Arial, Helvetica, sans-serif;color: ${color}; width: 100%;${!useContainer ? 'height:100%;' : ''}-webkit-overflow-scrolling: touch;padding-left: 0;padding-right: 0;}
.pell { height: 100%;} .pell-content { outline: 0; overflow-y: auto;padding: 10px;height: 100%;${contentCSSText}}
</style>
<style>
Expand Down