diff --git a/package.json b/package.json index e5bca197..76d255f3 100644 --- a/package.json +++ b/package.json @@ -66,6 +66,7 @@ "@projectstorm/react-diagrams-routing": "^6.6.1", "dagre": "^0.8.5", "krc-pagination": "^1.0.1", + "marked": "^4.0.18", "node": "^16.9.1", "pathfinding": "^0.4.18", "paths-js": "^0.4.11", @@ -85,6 +86,7 @@ "@babel/core": "^7.12.10", "@jupyterlab/builder": "^3.1.0", "@types/dagre": "^0.7.44", + "@types/marked": "^4.0.3", "@types/react": "^17.0.0", "@types/react-dom": "^17.0.0", "@typescript-eslint/eslint-plugin": "^4.8.1", diff --git a/src/components/CustomNodeWidget.tsx b/src/components/CustomNodeWidget.tsx index c051ac86..53b20a6f 100644 --- a/src/components/CustomNodeWidget.tsx +++ b/src/components/CustomNodeWidget.tsx @@ -17,6 +17,7 @@ import { formDialogWidget } from '../dialog/formDialogwidget'; import { showFormDialog } from '../dialog/FormDialog'; import { CommentDialog } from '../dialog/CommentDialog'; import ReactTooltip from 'react-tooltip'; +import { marked } from 'marked'; var S; (function (S) { @@ -111,6 +112,7 @@ export class CustomNodeWidget extends React.Component { nodeDeletable: false, commentInput: this.props.node['extras']['commentInput'], showDescription: false, + descriptionStr: "", imageGalleryItems:[ { @@ -205,7 +207,26 @@ export class CustomNodeWidget extends React.Component { */ async handleDescription() { await this.setState({ showDescription: !this.state.showDescription }); - ReactTooltip.show(this.element as Element) + this.getDescriptionStr(); + ReactTooltip.show(this.element as Element); + } + + renderText = text => { + var renderer = new marked.Renderer(); + renderer.link = function(href, title, text) { + var link = marked.Renderer.prototype.link.apply(this, arguments); + return link.replace(" { onDoubleClick={this.handleEditLiteral.bind(this)}> {this.props.node.getOptions().name} -