Skip to content

Commit

Permalink
chore(deps): cleaned up irrelevant dependencies in ui-markdown-editor
Browse files Browse the repository at this point in the history
Signed-off-by: Cronus1007 <[email protected]>
  • Loading branch information
Cronus1007 committed Apr 6, 2021
1 parent b4c3075 commit 318fb19
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 54 deletions.
49 changes: 0 additions & 49 deletions packages/ui-contract-editor/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -74,55 +74,6 @@ npm run build
```
Storybook will reload with the applied changes.
### Overview of Contract Editor Tool
The Contract Editor tool gives you the ability to examine and edit class contracts in a context that is isolated from the full class text. In other words, when you use the Contract Editor tool, you see and edit the contracts without having to work around other elements of the software text such as implementation.For routines, you can edit pre- and postconditions, and for classes, you can edit class invariants. The tool provides views of inherited contracts as well as immediate ones.
### Usage
```js
import { render } from 'react-dom';
import React, { useCallback, useState } from 'react';
import ContractEditor from '@accordproject/ui-contract-editor';
import { SlateTransformer } from '@accordproject/markdown-slate';
import 'semantic-ui-css/semantic.min.css';
const slateTransformer = new SlateTransformer();
const getContractSlateVal = () => {
const defaultContractMarkdown = `# Heading One
This is text. This is *italic* text. This is **bold** text. This is \`inline code\`. Fin.`;
return slateTransformer.fromMarkdown(defaultContractMarkdown);
};
const clausePropsObject = {
CLAUSE_DELETE_FUNCTION (function),
CLAUSE_EDIT_FUNCTION (function),
CLAUSE_TEST_FUNCTION (function),
}
const parseClauseFunction = () => { /* ... */ }
const loadTemplateObjectFunction = () => { /* ... */ }
const pasteToContractFunction = () => { /* ... */ }
const ContractEditorRenderer = () => {
const [slateValue, setSlateValue] = useState(() => {
const slate = getContractSlateVal();
return slate.document.children;
});

const onContractChange = useCallback((value) => { setSlateValue(value); }, []);
return (
<ContractEditor
value={slateValue}
lockText={false}
readOnly={false}
onChange={onContractChange}
clauseProps={clausePropsObject}
loadTemplateObject={loadTemplateObjectFunction}
pasteToContract={pasteToContractFunction}
onClauseUpdated={parseClauseFunction}
/>
);
}
render(<ContractEditorRenderer />, document.getElementById('root'));
```
### Overview of Clause Props Object
- `clauseProps`: An `object` for the clauses in the editor which contains a deletion, edit, and test function, as well as a header title string and color for clause icons on hover see below.
## Props
Expand Down
5 changes: 0 additions & 5 deletions packages/ui-markdown-editor/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -60,11 +60,6 @@
"@babel/plugin-transform-runtime": "7.10.3",
"@babel/preset-env": "7.10.3",
"@babel/preset-react": "7.10.1",
"@babel/cli": "7.13.10",
"@babel/core": "7.13.10",
"@babel/preset-env": "7.13.10",
"@babel/preset-react": "7.10.1",
"@babel/plugin-transform-runtime": "7.13.10",
"@rollup/plugin-babel": "5.0.4",
"@rollup/plugin-commonjs": "12.0.0",
"@rollup/plugin-node-resolve": "8.1.0",
Expand Down

0 comments on commit 318fb19

Please sign in to comment.