Skip to content

Commit

Permalink
Added caretColor
Browse files Browse the repository at this point in the history
  • Loading branch information
stulip committed May 25, 2021
1 parent 6d78802 commit 045db5b
Show file tree
Hide file tree
Showing 6 changed files with 8 additions and 2 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
- `foreColor` & `hiliteColor`
- Add @1x resources to solve the problem that some user resources are not found
- Add `onCursorPosition` Enter the position of the cursor
- Add `caretColor` cursor/selection color

#1.7.0
### Added
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ The editor component. Simply place this component in your view hierarchy to rece

- `backgroundColor`: Editor background color
- `color`: Editor text color
- `caretColor` cursor/selection color
- `placeholderColor`: Editor placeholder text color
- `contentCSSText`: editor content css text(initial valid)
- `cssText`: editor global css text(initial valid)
Expand Down
1 change: 1 addition & 0 deletions examples/src/example.js
Original file line number Diff line number Diff line change
Expand Up @@ -207,6 +207,7 @@ class Example extends React.Component {
const contentStyle = {
backgroundColor: '#2e3847',
color: '#fff',
caretColor: 'red', // initial valid// initial valid
placeholderColor: 'gray',
// cssText: '#editor {background-color: #f3f3f3}', // initial valid
contentCSSText: 'font-size: 16px; min-height: 200px;', // initial valid
Expand Down
1 change: 1 addition & 0 deletions index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,7 @@ export interface RichEditorProps extends WebViewProps {
editorStyle?: {
backgroundColor?: string; // editor background color
color?: string; // editor text color
caretColor?: string; // cursor/selection color
placeholderColor?: string; // editor placeholder text color
contentCSSText?: string; // editor content css text
cssText?: string; // editor global css text
Expand Down
3 changes: 2 additions & 1 deletion src/RichEditor.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ export default class RichTextEditor extends Component {
that.layout = {};
that.selectionChangeListeners = [];
const {
editorStyle: {backgroundColor, color, placeholderColor, cssText, contentCSSText} = {},
editorStyle: {backgroundColor, color, placeholderColor, cssText, contentCSSText, caretColor} = {},
html,
pasteAsPlainText,
onPaste,
Expand All @@ -69,6 +69,7 @@ export default class RichTextEditor extends Component {
createHTML({
backgroundColor,
color,
caretColor,
placeholderColor,
cssText,
contentCSSText,
Expand Down
3 changes: 2 additions & 1 deletion src/editor.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ function createHTML(options = {}) {
const {
backgroundColor = '#FFF',
color = '#000033',
caretColor = '',
placeholderColor = '#a9a9a9',
contentCSSText = '',
cssText = '',
Expand All @@ -43,7 +44,7 @@ function createHTML(options = {}) {
<style>
* {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;}
body { overflow-y: hidden; -webkit-overflow-scrolling: touch;height: 100%;background-color: ${backgroundColor};}
body { overflow-y: hidden; -webkit-overflow-scrolling: touch;height: 100%;background-color: ${backgroundColor};caret-color: ${caretColor};}
.content {font-family: Arial, Helvetica, sans-serif;color: ${color}; width: 100%;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>
Expand Down

0 comments on commit 045db5b

Please sign in to comment.