Merge pull request #1 from alicelupsan/react-list-form

Fixed Caret RichTextField issues Related: #2945
This commit is contained in:
alicelupsan 2022-08-31 09:59:32 +03:00 committed by GitHub
commit 8ec64337fd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 6 deletions

View File

@ -300,7 +300,7 @@ class ListForm extends React.Component<IListFormProps, IListFormState> {
const data = this.state.fieldsSchema
.reduce((newData, fld) => {
if (fld.DefaultValue && fld.FieldType.indexOf("TaxonomyField") > -1) {
newData[fld.InternalName] = fld.DefaultValue.replace(new RegExp("([#][0-9]+;#|^[0-9]+;#)", "g"), "")
newData[fld.InternalName] = fld.DefaultValue.replace(new RegExp("([#][0-9]+;#|^[0-9]+;#)", "g"), "");
} else {
newData[fld.InternalName] = fld.DefaultValue;
}

View File

@ -23,9 +23,6 @@ const SPFieldRichTextEdit: React.SFC<ISPFormFieldProps> = (props) => {
tinymce.init({});
const { Name, RichTextMode } = props.fieldSchema;
const value = props.value ? props.value : '';
if (tinymce.editors[`Editor-${Name}`] !== undefined) {
tinymce.editors[`Editor-${Name}`].setContent(value);
}
const editorConfig = {
"relative_urls": false, "convert_urls": false, "remove_script_host": false,
@ -39,8 +36,8 @@ const SPFieldRichTextEdit: React.SFC<ISPFormFieldProps> = (props) => {
return <Editor
id={`Editor-${Name}`}
init={editorConfig}
initialValue={props.value}
onChange={(event) => { props.valueChanged(event.target.getContent()); }}
value={value}
onEditorChange={props.valueChanged}
/>;
};