draft-js-link-detection-plugin
Advanced tools
@@ -29,6 +29,7 @@ "use strict"; | ||
var draft_js_1 = require("draft-js"); | ||
var draft_js_export_html_1 = require("draft-js-export-html"); | ||
var draft_js_link_detection_plugin_1 = __importDefault(require("../../plugin/draft-js-link-detection-plugin")); | ||
var Editor_styled_1 = require("./Editor.styled"); | ||
var linkifyPlugin = draft_js_link_detection_plugin_1.default(); | ||
var plugins = [linkifyPlugin]; | ||
var linkDetectionPlugin = draft_js_link_detection_plugin_1.default(); | ||
var plugins = [linkDetectionPlugin]; | ||
var Editor = function () { | ||
@@ -40,7 +41,14 @@ var editorRef = React.useRef(null); | ||
}; | ||
var html = React.useMemo(function () { | ||
var currentContent = editorState.getCurrentContent(); | ||
return draft_js_export_html_1.stateToHTML(currentContent); | ||
}, [editorState]); | ||
return (React.createElement("div", null, | ||
React.createElement(Editor_styled_1.Wrapper, null, | ||
React.createElement(draft_js_plugins_editor_1.default, { ref: editorRef, plugins: plugins, editorState: editorState, onChange: handleChangeEditor })), | ||
React.createElement("div", null, | ||
React.createElement("h3", null, "Result (HTML):"), | ||
React.createElement("div", { dangerouslySetInnerHTML: { __html: html } })), | ||
React.createElement(react_json_view_1.default, { src: draft_js_1.convertToRaw(editorState.getCurrentContent()), collapsed: 3 }))); | ||
}; | ||
exports.default = Editor; |
@@ -32,2 +32,3 @@ "use strict"; | ||
var contentState = editorState.getCurrentContent(); | ||
console.log('contentState', contentState); | ||
var entityKey = getCurrentLinkEntityKey(editorState); | ||
@@ -34,0 +35,0 @@ var nextEditorState = editorState; |
{ | ||
"name": "draft-js-link-detection-plugin", | ||
"version": "0.0.1-3", | ||
"version": "0.0.1", | ||
"description": "draft-js-link-detection-plugin", | ||
@@ -57,2 +57,3 @@ "keywords": [ | ||
"draft-js": "^0.11.6", | ||
"draft-js-export-html": "^1.4.1", | ||
"draft-js-plugins-editor": "^3.0.0", | ||
@@ -59,0 +60,0 @@ "enzyme": "^3.11.0", |
26021
27.19%30
25%515
26.23%37
2.78%