diff --git a/src/pages/index/index.jsx b/src/pages/index/index.jsx index 639152d..a91ac06 100644 --- a/src/pages/index/index.jsx +++ b/src/pages/index/index.jsx @@ -27,6 +27,9 @@ import { AtIcon } from "taro-ui"; import see from "../../images/see.png"; import group from "../../images/group.png"; import { marked } from "marked"; +import _ from "lodash"; +import OriginMark from "./conpoments/OriginMark/index"; + marked.setOptions({ breaks: true, // 是否回车换行 highlight(code, lang) { @@ -46,18 +49,20 @@ marked.setOptions({ // 0️⃣1️⃣2️⃣3️⃣4️⃣5️⃣6️⃣7️⃣8️⃣9️⃣🔟 // ©️⭐🔍〰️➖ const renderer = new marked.Renderer(); +const originRenderer = _.cloneDeep(renderer); + // 图片调整300px renderer.image = function (href, title, text) { - console.log("href, title, text", href, title, text); + // console.log("href, title, text", href, title, text); //
(.*?)<\/p>/; var str = quote; var match = regex.exec(str); if (match != null) { var content = match[1]; // 获取第一个捕获组的内容 - console.log(content); + // console.log(content); } //
return `\t👉${content} `; }; +// 使用拓展 marked.use({ renderer }); + //  -const markTextStr = marked( - ` +const markTextStr = ` ## 标题 > 测试引用桔子的样子 随便测试普通的文本,要不要来个\`内敛\`的字符串 @@ -156,39 +162,40 @@ const markTextStr = marked( 永远不要相信一个 --- 相信我 - ` -); - + `; // export default class Index extends Component { const Index = () => { const [markText, setmarkText] = useState(null); + const [oldmarkText, setoldmarkText] = useState(null); + const [currentRender, setcurrentRender] = useState(null); - - const editorReady = (e) => { - Taro.createSelectorQuery() - .select("#editor") - .context((res) => { - this.editorCtx = res.context; - }) - .exec(); - }; - const onConfirm = (onConfirmtxt) => { - console.log("onConfirmtxt--->",onConfirmtxt.detail.value); + console.log("onConfirmtxt--->", onConfirmtxt.detail.value); }; const onBlur = (onBlurtxt) => { console.log("onBlurtxt--->", onBlurtxt.detail.value); - setmarkText(marked(onBlurtxt.detail.value)) + if(onBlurtxt.detail.value){ + setmarkText(onBlurtxt.detail.value); + } }; - + const onInput = (onInputtxt) => { + console.log("onInputtxt--->", onInputtxt.detail.value); + if(onInputtxt.detail.value){ + setmarkText(onInputtxt.detail.value); + } + + }; + const onBridgeReady = () => { WeixinJSBridge.call("hideOptionMenu"); }; useEffect(() => { // console.log("markTextStr=>", markTextStr); - setmarkText(marked(markTextStr)); + // setmarkText(markTextStr); + setmarkText(null); + }, []); return ( @@ -199,13 +206,19 @@ const Index = () => { autoHeight autoFocus onConfirm={onConfirm} - onBlur={onBlur} + // onBlur={onBlur} + onInput={onInput} /> -