Fetaure:Node类的setText方法增加第二个参数,以支持设置富文本内容
This commit is contained in:
parent
2d7c091071
commit
410f0be05e
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "simple-mind-map",
|
"name": "simple-mind-map",
|
||||||
"version": "0.4.1",
|
"version": "0.4.2",
|
||||||
"description": "一个简单的web在线思维导图",
|
"description": "一个简单的web在线思维导图",
|
||||||
"authors": [
|
"authors": [
|
||||||
{
|
{
|
||||||
|
|||||||
@ -1217,8 +1217,8 @@ class Node {
|
|||||||
|
|
||||||
// 设置文本
|
// 设置文本
|
||||||
|
|
||||||
setText(text) {
|
setText(text, richText) {
|
||||||
this.mindMap.execCommand('SET_NODE_TEXT', this, text)
|
this.mindMap.execCommand('SET_NODE_TEXT', this, text, richText)
|
||||||
}
|
}
|
||||||
|
|
||||||
// 设置图片
|
// 设置图片
|
||||||
|
|||||||
@ -1,5 +1,9 @@
|
|||||||
# Changelog
|
# Changelog
|
||||||
|
|
||||||
|
## 0.4.2
|
||||||
|
|
||||||
|
New: The `setText` method of the Node class adds a second parameter to support setting rich text content.
|
||||||
|
|
||||||
## 0.4.1
|
## 0.4.1
|
||||||
|
|
||||||
New: 1.Add and throw node mouseenter and mouseleave events; 2.Node rich text supports setting background color; 3.Node rich text supports clear style.
|
New: 1.Add and throw node mouseenter and mouseleave events; 2.Node rich text supports setting background color; 3.Node rich text supports clear style.
|
||||||
|
|||||||
@ -1,6 +1,8 @@
|
|||||||
<template>
|
<template>
|
||||||
<div>
|
<div>
|
||||||
<h1>Changelog</h1>
|
<h1>Changelog</h1>
|
||||||
|
<h2>0.4.2</h2>
|
||||||
|
<p>New: The <code>setText</code> method of the Node class adds a second parameter to support setting rich text content.</p>
|
||||||
<h2>0.4.1</h2>
|
<h2>0.4.1</h2>
|
||||||
<p>New: 1.Add and throw node mouseenter and mouseleave events; 2.Node rich text supports setting background color; 3.Node rich text supports clear style.</p>
|
<p>New: 1.Add and throw node mouseenter and mouseleave events; 2.Node rich text supports setting background color; 3.Node rich text supports clear style.</p>
|
||||||
<p>Fix: 1.Mac system touchpad scaling is the opposite problem; 2.When the device window.devicePixelRatio is not 1, the size of the rich text node in the exported image will become larger when there are rich text nodes.</p>
|
<p>Fix: 1.Mac system touchpad scaling is the opposite problem; 2.When the device window.devicePixelRatio is not 1, the size of the rich text node in the exported image will become larger when there are rich text nodes.</p>
|
||||||
|
|||||||
@ -259,7 +259,7 @@ Executes a command, which will add a record to the history stack for undo or
|
|||||||
redo. All commands are as follows:
|
redo. All commands are as follows:
|
||||||
|
|
||||||
| Command name | Description | Parameters |
|
| Command name | Description | Parameters |
|
||||||
| ---------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
| ---------------------------------- | ------------------------------------------------------------ | ------------------------------------------------------------ |
|
||||||
| SELECT_ALL | Select all | |
|
| SELECT_ALL | Select all | |
|
||||||
| BACK | Go back a specified number of steps | step (the number of steps to go back, default is 1) |
|
| BACK | Go back a specified number of steps | step (the number of steps to go back, default is 1) |
|
||||||
| FORWARD | Go forward a specified number of steps | step (the number of steps to go forward, default is 1) |
|
| FORWARD | Go forward a specified number of steps | step (the number of steps to go forward, default is 1) |
|
||||||
@ -277,7 +277,7 @@ redo. All commands are as follows:
|
|||||||
| UNEXPAND_ALL | Collapse all nodes | |
|
| UNEXPAND_ALL | Collapse all nodes | |
|
||||||
| UNEXPAND_TO_LEVEL (v0.2.8+) | Expand to a specified level | level (the level to expand to, 1, 2, 3...) |
|
| UNEXPAND_TO_LEVEL (v0.2.8+) | Expand to a specified level | level (the level to expand to, 1, 2, 3...) |
|
||||||
| SET_NODE_DATA | Update node data, that is, update the data in the data object of the node data object | node (the node to set), data (object, the data to update, e.g. `{expand: true}`) |
|
| SET_NODE_DATA | Update node data, that is, update the data in the data object of the node data object | node (the node to set), data (object, the data to update, e.g. `{expand: true}`) |
|
||||||
| SET_NODE_TEXT | Set node text | node (the node to set), text (the new text for the node) |
|
| SET_NODE_TEXT | Set node text | node (the node to set), text (the new text for the node), richText(v0.4.0+, If you want to set a rich text character, you need to set it to `true`) |
|
||||||
| SET_NODE_IMAGE | Set Node Image | node (node to set), imgData (object, image information, structured as: `{url, title, width, height}`, the width and height of the image must be passed) |
|
| SET_NODE_IMAGE | Set Node Image | node (node to set), imgData (object, image information, structured as: `{url, title, width, height}`, the width and height of the image must be passed) |
|
||||||
| SET_NODE_ICON | Set Node Icon | node (node to set), icons (array, predefined image names array, available icons can be obtained in the nodeIconList list in the [https://github.com/wanglin2/mind-map/blob/main/simple-mind-map/src/svg/icons.js](https://github.com/wanglin2/mind-map/blob/main/simple-mind-map/src/svg/icons.js) file, icon name is type_name, such as ['priority_1']) |
|
| SET_NODE_ICON | Set Node Icon | node (node to set), icons (array, predefined image names array, available icons can be obtained in the nodeIconList list in the [https://github.com/wanglin2/mind-map/blob/main/simple-mind-map/src/svg/icons.js](https://github.com/wanglin2/mind-map/blob/main/simple-mind-map/src/svg/icons.js) file, icon name is type_name, such as ['priority_1']) |
|
||||||
| SET_NODE_HYPERLINK | Set Node Hyperlink | node (node to set), link (hyperlink address), title (hyperlink name, optional) |
|
| SET_NODE_HYPERLINK | Set Node Hyperlink | node (node to set), link (hyperlink address), title (hyperlink name, optional) |
|
||||||
|
|||||||
@ -565,7 +565,7 @@ redo. All commands are as follows:</p>
|
|||||||
<tr>
|
<tr>
|
||||||
<td>SET_NODE_TEXT</td>
|
<td>SET_NODE_TEXT</td>
|
||||||
<td>Set node text</td>
|
<td>Set node text</td>
|
||||||
<td>node (the node to set), text (the new text for the node)</td>
|
<td>node (the node to set), text (the new text for the node), richText(v0.4.0+, If you want to set a rich text character, you need to set it to <code>true</code>)</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td>SET_NODE_IMAGE</td>
|
<td>SET_NODE_IMAGE</td>
|
||||||
|
|||||||
@ -62,6 +62,8 @@ Documentation, etc.
|
|||||||
|
|
||||||
[When you press the direction key, how does the TV find the next focus](https://juejin.cn/post/7199666255883927612)
|
[When you press the direction key, how does the TV find the next focus](https://juejin.cn/post/7199666255883927612)
|
||||||
|
|
||||||
|
[How to simulate the background image style of css in canvas](https://juejin.cn/post/7204854015463538744)
|
||||||
|
|
||||||
## Special Note
|
## Special Note
|
||||||
|
|
||||||
This project is rough and has not been thoroughly tested, its features are not
|
This project is rough and has not been thoroughly tested, its features are not
|
||||||
|
|||||||
@ -49,6 +49,7 @@ full screen, support mini map</li>
|
|||||||
<p><a href="https://juejin.cn/post/6987711560521089061">Technical Analysis of Web Mind Map Implementation (chi)</a></p>
|
<p><a href="https://juejin.cn/post/6987711560521089061">Technical Analysis of Web Mind Map Implementation (chi)</a></p>
|
||||||
<p><a href="https://juejin.cn/post/7157681502506090510">Only a hundred lines of code are needed to add local file operation capability to your Web page. Are you sure not to try?</a></p>
|
<p><a href="https://juejin.cn/post/7157681502506090510">Only a hundred lines of code are needed to add local file operation capability to your Web page. Are you sure not to try?</a></p>
|
||||||
<p><a href="https://juejin.cn/post/7199666255883927612">When you press the direction key, how does the TV find the next focus</a></p>
|
<p><a href="https://juejin.cn/post/7199666255883927612">When you press the direction key, how does the TV find the next focus</a></p>
|
||||||
|
<p><a href="https://juejin.cn/post/7204854015463538744">How to simulate the background image style of css in canvas</a></p>
|
||||||
<h2>Special Note</h2>
|
<h2>Special Note</h2>
|
||||||
<p>This project is rough and has not been thoroughly tested, its features are not
|
<p>This project is rough and has not been thoroughly tested, its features are not
|
||||||
yet fully developed, and there are some performance issues, especially when the number of nodes is large. It is only for
|
yet fully developed, and there are some performance issues, especially when the number of nodes is large. It is only for
|
||||||
|
|||||||
@ -121,7 +121,9 @@ if `key` is not passed, return the `data` object
|
|||||||
Set the value of the specified key in the data object of the node's real data
|
Set the value of the specified key in the data object of the node's real data
|
||||||
nodeData, `SET_NODE_DATA` command's shortcut method
|
nodeData, `SET_NODE_DATA` command's shortcut method
|
||||||
|
|
||||||
### setText(text)
|
### setText(text, richText)
|
||||||
|
|
||||||
|
- `richText`: v0.4.2+,`Boolean`, If you want to set rich text content, that is, `html` character, `richText` needs to be passed `true`
|
||||||
|
|
||||||
Setting the node text, a shortcut for the `SET_NODE_TEXT` command
|
Setting the node text, a shortcut for the `SET_NODE_TEXT` command
|
||||||
|
|
||||||
|
|||||||
@ -67,7 +67,10 @@ if <code>key</code> is not passed, return the <code>data</code> object</p>
|
|||||||
<h3>setData(data)</h3>
|
<h3>setData(data)</h3>
|
||||||
<p>Set the value of the specified key in the data object of the node's real data
|
<p>Set the value of the specified key in the data object of the node's real data
|
||||||
nodeData, <code>SET_NODE_DATA</code> command's shortcut method</p>
|
nodeData, <code>SET_NODE_DATA</code> command's shortcut method</p>
|
||||||
<h3>setText(text)</h3>
|
<h3>setText(text, richText)</h3>
|
||||||
|
<ul>
|
||||||
|
<li><code>richText</code>: v0.4.2+,<code>Boolean</code>, If you want to set rich text content, that is, <code>html</code> character, <code>richText</code> needs to be passed <code>true</code></li>
|
||||||
|
</ul>
|
||||||
<p>Setting the node text, a shortcut for the <code>SET_NODE_TEXT</code> command</p>
|
<p>Setting the node text, a shortcut for the <code>SET_NODE_TEXT</code> command</p>
|
||||||
<h3>setImage(imgData)</h3>
|
<h3>setImage(imgData)</h3>
|
||||||
<p>Setting the node image, a shortcut for the <code>SET_NODE_IMAGE</code> command</p>
|
<p>Setting the node image, a shortcut for the <code>SET_NODE_IMAGE</code> command</p>
|
||||||
|
|||||||
@ -1,5 +1,9 @@
|
|||||||
# Changelog
|
# Changelog
|
||||||
|
|
||||||
|
## 0.4.2
|
||||||
|
|
||||||
|
新增:`Node`类的`setText`方法增加第二个参数,以支持设置富文本内容。
|
||||||
|
|
||||||
## 0.4.1
|
## 0.4.1
|
||||||
|
|
||||||
新增:1.新增抛出节点鼠标移入和移除事件;2.节点富文本支持设置背景颜色;3.节点富文本支持清除样式。
|
新增:1.新增抛出节点鼠标移入和移除事件;2.节点富文本支持设置背景颜色;3.节点富文本支持清除样式。
|
||||||
|
|||||||
@ -1,6 +1,8 @@
|
|||||||
<template>
|
<template>
|
||||||
<div>
|
<div>
|
||||||
<h1>Changelog</h1>
|
<h1>Changelog</h1>
|
||||||
|
<h2>0.4.2</h2>
|
||||||
|
<p>新增:<code>Node</code>类的<code>setText</code>方法增加第二个参数,以支持设置富文本内容。</p>
|
||||||
<h2>0.4.1</h2>
|
<h2>0.4.1</h2>
|
||||||
<p>新增:1.新增抛出节点鼠标移入和移除事件;2.节点富文本支持设置背景颜色;3.节点富文本支持清除样式。</p>
|
<p>新增:1.新增抛出节点鼠标移入和移除事件;2.节点富文本支持设置背景颜色;3.节点富文本支持清除样式。</p>
|
||||||
<p>修复:1.Mac系统触控板缩放相反的问题;2.设备window.devicePixelRatio不为1时,当存在富文本节点时导出的图片中富文本节点尺寸会变大的问题。</p>
|
<p>修复:1.Mac系统触控板缩放相反的问题;2.设备window.devicePixelRatio不为1时,当存在富文本节点时导出的图片中富文本节点尺寸会变大的问题。</p>
|
||||||
|
|||||||
@ -253,7 +253,7 @@ mindMap.updateConfig({
|
|||||||
执行命令,每执行一个命令就会在历史堆栈里添加一条记录用于回退或前进。所有命令如下:
|
执行命令,每执行一个命令就会在历史堆栈里添加一条记录用于回退或前进。所有命令如下:
|
||||||
|
|
||||||
| 命令名称 | 描述 | 参数 |
|
| 命令名称 | 描述 | 参数 |
|
||||||
| --------------------------------- | -------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
|
| ----------------------------------- | ------------------------------------------------------------ | ------------------------------------------------------------ |
|
||||||
| SELECT_ALL | 全选 | |
|
| SELECT_ALL | 全选 | |
|
||||||
| BACK | 回退指定的步数 | step(要回退的步数,默认为1) |
|
| BACK | 回退指定的步数 | step(要回退的步数,默认为1) |
|
||||||
| FORWARD | 前进指定的步数 | step(要前进的步数,默认为1) |
|
| FORWARD | 前进指定的步数 | step(要前进的步数,默认为1) |
|
||||||
@ -272,7 +272,7 @@ mindMap.updateConfig({
|
|||||||
| UNEXPAND_ALL | 收起所有节点 | |
|
| UNEXPAND_ALL | 收起所有节点 | |
|
||||||
| UNEXPAND_TO_LEVEL(v0.2.8+) | 展开到指定层级 | level(要展开到的层级,1、2、3...) |
|
| UNEXPAND_TO_LEVEL(v0.2.8+) | 展开到指定层级 | level(要展开到的层级,1、2、3...) |
|
||||||
| SET_NODE_DATA | 更新节点数据,即更新节点数据对象里`data`对象的数据 | node(要设置的节点)、data(对象,要更新的数据,如`{expand: true}`) |
|
| SET_NODE_DATA | 更新节点数据,即更新节点数据对象里`data`对象的数据 | node(要设置的节点)、data(对象,要更新的数据,如`{expand: true}`) |
|
||||||
| SET_NODE_TEXT | 设置节点文本 | node(要设置的节点)、text(要设置的文本字符串,换行可以使用`\n`) |
|
| SET_NODE_TEXT | 设置节点文本 | node(要设置的节点)、text(要设置的文本字符串,换行可以使用`\n`)、richText(v0.4.0+,如果要设置的是富文本字符,需要设为`true`) |
|
||||||
| SET_NODE_IMAGE | 设置节点图片 | node(要设置的节点)、imgData(对象,图片信息,结构为:`{url, title, width, height}`,图片的宽高必须要传) |
|
| SET_NODE_IMAGE | 设置节点图片 | node(要设置的节点)、imgData(对象,图片信息,结构为:`{url, title, width, height}`,图片的宽高必须要传) |
|
||||||
| SET_NODE_ICON | 设置节点图标 | node(要设置的节点)、icons(数组,预定义的图片名称组成的数组,可用图标可在[https://github.com/wanglin2/mind-map/blob/main/simple-mind-map/src/svg/icons.js](https://github.com/wanglin2/mind-map/blob/main/simple-mind-map/src/svg/icons.js)文件里的`nodeIconList`列表里获取到,图标名称为`type_name`,如`['priority_1']`) |
|
| SET_NODE_ICON | 设置节点图标 | node(要设置的节点)、icons(数组,预定义的图片名称组成的数组,可用图标可在[https://github.com/wanglin2/mind-map/blob/main/simple-mind-map/src/svg/icons.js](https://github.com/wanglin2/mind-map/blob/main/simple-mind-map/src/svg/icons.js)文件里的`nodeIconList`列表里获取到,图标名称为`type_name`,如`['priority_1']`) |
|
||||||
| SET_NODE_HYPERLINK | 设置节点超链接 | node(要设置的节点)、link(超链接地址)、title(超链接名称,可选) |
|
| SET_NODE_HYPERLINK | 设置节点超链接 | node(要设置的节点)、link(超链接地址)、title(超链接名称,可选) |
|
||||||
|
|||||||
@ -560,7 +560,7 @@ mindMap.setTheme(<span class="hljs-string">'主题名称'</span>)
|
|||||||
<tr>
|
<tr>
|
||||||
<td>SET_NODE_TEXT</td>
|
<td>SET_NODE_TEXT</td>
|
||||||
<td>设置节点文本</td>
|
<td>设置节点文本</td>
|
||||||
<td>node(要设置的节点)、text(要设置的文本字符串,换行可以使用<code>\n</code>)</td>
|
<td>node(要设置的节点)、text(要设置的文本字符串,换行可以使用<code>\n</code>)、richText(v0.4.0+,如果要设置的是富文本字符,需要设为<code>true</code>)</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td>SET_NODE_IMAGE</td>
|
<td>SET_NODE_IMAGE</td>
|
||||||
|
|||||||
@ -51,6 +51,8 @@
|
|||||||
|
|
||||||
[当你按下方向键,电视是如何寻找下一个焦点的](https://juejin.cn/post/7199666255883927612)
|
[当你按下方向键,电视是如何寻找下一个焦点的](https://juejin.cn/post/7199666255883927612)
|
||||||
|
|
||||||
|
[如何在canvas中模拟css的背景图片样式](https://juejin.cn/post/7204854015463538744)
|
||||||
|
|
||||||
## 特别说明
|
## 特别说明
|
||||||
|
|
||||||
本项目较粗糙,未进行完整测试,功能尚不是很完善,性能也存在一些问题,尤其当节点数量比较庞大的时候,仅用于学习和参考,请谨慎用于实际项目。
|
本项目较粗糙,未进行完整测试,功能尚不是很完善,性能也存在一些问题,尤其当节点数量比较庞大的时候,仅用于学习和参考,请谨慎用于实际项目。
|
||||||
|
|||||||
@ -38,6 +38,7 @@
|
|||||||
<p><a href="https://juejin.cn/post/6987711560521089061">Web思维导图实现的技术点分析</a></p>
|
<p><a href="https://juejin.cn/post/6987711560521089061">Web思维导图实现的技术点分析</a></p>
|
||||||
<p><a href="https://juejin.cn/post/7157681502506090510">只需百来行代码,为你的Web页面增加本地文件操作能力,确定不试试吗?</a></p>
|
<p><a href="https://juejin.cn/post/7157681502506090510">只需百来行代码,为你的Web页面增加本地文件操作能力,确定不试试吗?</a></p>
|
||||||
<p><a href="https://juejin.cn/post/7199666255883927612">当你按下方向键,电视是如何寻找下一个焦点的</a></p>
|
<p><a href="https://juejin.cn/post/7199666255883927612">当你按下方向键,电视是如何寻找下一个焦点的</a></p>
|
||||||
|
<p><a href="https://juejin.cn/post/7204854015463538744">如何在canvas中模拟css的背景图片样式</a></p>
|
||||||
<h2>特别说明</h2>
|
<h2>特别说明</h2>
|
||||||
<p>本项目较粗糙,未进行完整测试,功能尚不是很完善,性能也存在一些问题,尤其当节点数量比较庞大的时候,仅用于学习和参考,请谨慎用于实际项目。</p>
|
<p>本项目较粗糙,未进行完整测试,功能尚不是很完善,性能也存在一些问题,尤其当节点数量比较庞大的时候,仅用于学习和参考,请谨慎用于实际项目。</p>
|
||||||
<p>项目内置的主题和图标来自于:</p>
|
<p>项目内置的主题和图标来自于:</p>
|
||||||
|
|||||||
@ -114,7 +114,9 @@
|
|||||||
|
|
||||||
设置节点数据,`SET_NODE_DATA`命令的快捷方法
|
设置节点数据,`SET_NODE_DATA`命令的快捷方法
|
||||||
|
|
||||||
### setText(text)
|
### setText(text, richText)
|
||||||
|
|
||||||
|
- `richText`:v0.4.2+,`Boolean`,如果要设置的是富文本内容,也就是`html`字符,`richText`需要传`true`
|
||||||
|
|
||||||
设置节点文本,`SET_NODE_TEXT`命令的快捷方法
|
设置节点文本,`SET_NODE_TEXT`命令的快捷方法
|
||||||
|
|
||||||
|
|||||||
@ -60,7 +60,10 @@
|
|||||||
<p>获取该节点真实数据<code>nodeData</code>的<code>data</code>对象里的指定值,<code>key</code>不传返回这个<code>data</code>对象</p>
|
<p>获取该节点真实数据<code>nodeData</code>的<code>data</code>对象里的指定值,<code>key</code>不传返回这个<code>data</code>对象</p>
|
||||||
<h3>setData(data)</h3>
|
<h3>setData(data)</h3>
|
||||||
<p>设置节点数据,<code>SET_NODE_DATA</code>命令的快捷方法</p>
|
<p>设置节点数据,<code>SET_NODE_DATA</code>命令的快捷方法</p>
|
||||||
<h3>setText(text)</h3>
|
<h3>setText(text, richText)</h3>
|
||||||
|
<ul>
|
||||||
|
<li><code>richText</code>:v0.4.2+,<code>Boolean</code>,如果要设置的是富文本内容,也就是<code>html</code>字符,<code>richText</code>需要传<code>true</code></li>
|
||||||
|
</ul>
|
||||||
<p>设置节点文本,<code>SET_NODE_TEXT</code>命令的快捷方法</p>
|
<p>设置节点文本,<code>SET_NODE_TEXT</code>命令的快捷方法</p>
|
||||||
<h3>setImage(imgData)</h3>
|
<h3>setImage(imgData)</h3>
|
||||||
<p>设置节点图片,<code>SET_NODE_IMAGE</code>命令的快捷方法</p>
|
<p>设置节点图片,<code>SET_NODE_IMAGE</code>命令的快捷方法</p>
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user