Skip to content
This repository was archived by the owner on Feb 7, 2025. It is now read-only.

Commit 744bb5d

Browse files
authored
fix(ContractEditor): correct onClauseUpdated call (#108)
* fix(ContractEditor): correct onClauseUpdated call * docs(ContractEditor): improve function props Signed-off-by: irmerk <[email protected]>
1 parent e038e0c commit 744bb5d

File tree

2 files changed

+12
-6
lines changed

2 files changed

+12
-6
lines changed

packages/cicero-ui/src/lib/ContractEditor/README.md

+11-5
Original file line numberDiff line numberDiff line change
@@ -61,18 +61,24 @@ render(<ContractEditorRenderer />, document.getElementById('root'));
6161
6262
#### Values
6363
64-
- `value` [OPTIONAL]: An `object` which is the initial contents of the editor.
64+
- `value` [OPTIONAL]: An `array` which is the initial contents of the editor.
6565
- `lockText` [OPTIONAL]: A `boolean` to lock all non variable text.
6666
- `readOnly` [OPTIONAL]: A `boolean` to lock all text and remove the formatting toolbar.
6767
- `activeButton` [OPTIONAL]: Optional `object` to change formatting button active state color
6868
- `{ background: '#FFF', symbol: '#000' }`
6969
7070
#### Functionality
7171
72-
- `onChange` [OPTIONAL]: A callback `function` called when the contents of the editor change.
73-
- `loadTemplateObject` [OPTIONAL]: A callback `function` to load a template.
74-
- `onClauseUpdated` [OPTIONAL]: A callback `function` called when text inside of a clause is changed.
75-
- `pasteToContract` [OPTIONAL]: A callback `function` to load a clause template via copy/paste.
72+
- `onChange` [OPTIONAL]: A callback `function` called when the contents of the editor change. Argument:
73+
- `value`: The Slate nodes `array` representing all the rich text
74+
- `loadTemplateObject` [OPTIONAL]: A callback `function` to load a template. Argument:
75+
- `uri`: URI `string` source for loading the template
76+
- `onClauseUpdated` [OPTIONAL]: A callback `function` called when text inside of a clause is changed. Arguments:
77+
- `clause`: The Slate node `object` representation of the clause
78+
- `justAdded`: A `boolean` indicating if this was just added (likely via a paste action)
79+
- `pasteToContract` [OPTIONAL]: A callback `function` to load a clause template via copy/paste. Arguments:
80+
- `clauseid`: Data `string` from the clause in Slate to indicate a `uuid`
81+
- `src`: URI `string` source for loading the template
7682

7783
### Available Functionality
7884

packages/cicero-ui/src/lib/ContractEditor/plugins/withClauses.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ const withClauses = (editor, withClausesProps) => {
114114

115115
clausesToParseAndPaste.forEach((clause) => {
116116
pasteToContract(clause.data.clauseid, clause.data.src);
117-
onClauseUpdated(editor, clause);
117+
onClauseUpdated(clause, true);
118118
});
119119

120120
const NEW_HTML_DOM = htmlTransformer

0 commit comments

Comments
 (0)