mirror of
https://github.com/wanglin2/mind-map.git
synced 2026-02-23 11:27:41 +08:00
Merge branch 'feature' into main
This commit is contained in:
commit
ffdf53941a
File diff suppressed because one or more lines are too long
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "simple-mind-map",
|
||||
"version": "0.6.1",
|
||||
"version": "0.6.2",
|
||||
"description": "一个简单的web在线思维导图",
|
||||
"authors": [
|
||||
{
|
||||
|
||||
@ -259,4 +259,24 @@ export const layoutValueList = [
|
||||
CONSTANTS.LAYOUT.TIMELINE,
|
||||
CONSTANTS.LAYOUT.TIMELINE2,
|
||||
CONSTANTS.LAYOUT.FISHBONE
|
||||
]
|
||||
|
||||
// 节点数据中非样式的字段
|
||||
export const nodeDataNoStylePropList = [
|
||||
'text',
|
||||
'image',
|
||||
'imageTitle',
|
||||
'imageSize',
|
||||
'icon',
|
||||
'tag',
|
||||
'hyperlink',
|
||||
'hyperlinkTitle',
|
||||
'note',
|
||||
'expand',
|
||||
'isActive',
|
||||
'generalization',
|
||||
'richText',
|
||||
'resetRichText',
|
||||
'uid',
|
||||
'activeStyle'
|
||||
]
|
||||
@ -798,6 +798,11 @@ class Node {
|
||||
getData(key) {
|
||||
return key ? this.nodeData.data[key] || '' : this.nodeData.data
|
||||
}
|
||||
|
||||
// 是否存在自定义样式
|
||||
hasCustomStyle() {
|
||||
return this.style.hasCustomStyle()
|
||||
}
|
||||
}
|
||||
|
||||
export default Node
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
import { tagColorList } from '../../../constants/constant'
|
||||
import { tagColorList, nodeDataNoStylePropList } from '../../../constants/constant'
|
||||
const rootProp = ['paddingX', 'paddingY']
|
||||
const backgroundStyleProps = ['backgroundColor', 'backgroundImage', 'backgroundRepeat', 'backgroundPosition', 'backgroundSize']
|
||||
|
||||
@ -209,6 +209,17 @@ class Style {
|
||||
node2.fill({ color: color })
|
||||
fillNode.fill({ color: fill })
|
||||
}
|
||||
|
||||
// 是否设置了自定义的样式
|
||||
hasCustomStyle() {
|
||||
let res = false
|
||||
Object.keys(this.ctx.nodeData.data).forEach((item) => {
|
||||
if (!nodeDataNoStylePropList.includes(item)) {
|
||||
res = true
|
||||
}
|
||||
})
|
||||
return res
|
||||
}
|
||||
}
|
||||
|
||||
Style.cacheStyle = null
|
||||
|
||||
@ -64,8 +64,18 @@ function createIconNode() {
|
||||
function createRichTextNode() {
|
||||
let g = new G()
|
||||
// 重新设置富文本节点内容
|
||||
if (this.nodeData.data.resetRichText || [CONSTANTS.CHANGE_THEME].includes(this.mindMap.renderer.renderSource)) {
|
||||
let recoverText = false
|
||||
if (this.nodeData.data.resetRichText) {
|
||||
delete this.nodeData.data.resetRichText
|
||||
recoverText = true
|
||||
}
|
||||
if ([CONSTANTS.CHANGE_THEME].includes(this.mindMap.renderer.renderSource)) {
|
||||
// 如果自定义过样式则不允许覆盖
|
||||
if (!this.hasCustomStyle()) {
|
||||
recoverText = true
|
||||
}
|
||||
}
|
||||
if (recoverText) {
|
||||
let text = getTextFromHtml(this.nodeData.data.text)
|
||||
this.nodeData.data.text = `<p><span style="${this.style.createStyleText()}">${text}</span></p>`
|
||||
}
|
||||
|
||||
@ -219,7 +219,7 @@ class RichText {
|
||||
underline: node.style.merge('textDecoration') === 'underline',
|
||||
strike: node.style.merge('textDecoration') === 'line-through'
|
||||
}
|
||||
this.formatAllText(style)
|
||||
this.pureFormatAllText(style)
|
||||
}
|
||||
|
||||
// 获取当前正在编辑的内容
|
||||
@ -325,7 +325,7 @@ class RichText {
|
||||
|
||||
// 中文输入结束
|
||||
onCompositionEnd() {
|
||||
if (!this.showTextEdit) {
|
||||
if (!this.showTextEdit || !this.lostStyle) {
|
||||
return
|
||||
}
|
||||
this.isCompositing = false
|
||||
@ -372,6 +372,11 @@ class RichText {
|
||||
// 格式化所有文本
|
||||
formatAllText(config = {}) {
|
||||
this.syncFormatToNodeConfig(config)
|
||||
this.pureFormatAllText(config)
|
||||
}
|
||||
|
||||
// 纯粹的格式化所有文本
|
||||
pureFormatAllText(config = {}) {
|
||||
this.quill.formatText(0, this.quill.getLength(), config)
|
||||
}
|
||||
|
||||
|
||||
@ -1,5 +1,9 @@
|
||||
# Changelog
|
||||
|
||||
## 0.6.2
|
||||
|
||||
Fix: 1.Fixed the problem that the new node does not change with the theme in rich Text mode.
|
||||
|
||||
## 0.6.1
|
||||
|
||||
Fix: 1.Fixed the issue of high movement sensitivity when using the touchpad when changing mouse scrolling to moving the canvas behavior.
|
||||
|
||||
@ -1,6 +1,8 @@
|
||||
<template>
|
||||
<div>
|
||||
<h1>Changelog</h1>
|
||||
<h2>0.6.2</h2>
|
||||
<p>Fix: 1.Fixed the problem that the new node does not change with the theme in rich Text mode.</p>
|
||||
<h2>0.6.1</h2>
|
||||
<p>Fix: 1.Fixed the issue of high movement sensitivity when using the touchpad when changing mouse scrolling to moving the canvas behavior.</p>
|
||||
<h2>0.6.0-fix.1</h2>
|
||||
|
||||
@ -56,6 +56,12 @@ Whether the node is currently being dragged
|
||||
|
||||
## Methods
|
||||
|
||||
### hasCustomStyle()
|
||||
|
||||
> v0.6.2+
|
||||
|
||||
Gets whether a custom style has been set.
|
||||
|
||||
### getSize()
|
||||
|
||||
Update the width and height of the node by recreating the node content, and return a Boolean value indicating whether the width and height have changed
|
||||
|
||||
@ -31,6 +31,11 @@
|
||||
</blockquote>
|
||||
<p>Whether the node is currently being dragged</p>
|
||||
<h2>Methods</h2>
|
||||
<h3>hasCustomStyle()</h3>
|
||||
<blockquote>
|
||||
<p>v0.6.2+</p>
|
||||
</blockquote>
|
||||
<p>Gets whether a custom style has been set.</p>
|
||||
<h3>getSize()</h3>
|
||||
<p>Update the width and height of the node by recreating the node content, and return a Boolean value indicating whether the width and height have changed</p>
|
||||
<h3>render()</h3>
|
||||
|
||||
@ -1,5 +1,9 @@
|
||||
# Changelog
|
||||
|
||||
## 0.6.2
|
||||
|
||||
修复:1.修复富文本模式下,新建节点不随主题变化而变化的问题。
|
||||
|
||||
## 0.6.1
|
||||
|
||||
修复:1.修复将鼠标滚动改为移动画布行为后,使用触控板操作时移动灵敏度过高的问题。
|
||||
|
||||
@ -1,6 +1,8 @@
|
||||
<template>
|
||||
<div>
|
||||
<h1>Changelog</h1>
|
||||
<h2>0.6.2</h2>
|
||||
<p>修复:1.修复富文本模式下,新建节点不随主题变化而变化的问题。</p>
|
||||
<h2>0.6.1</h2>
|
||||
<p>修复:1.修复将鼠标滚动改为移动画布行为后,使用触控板操作时移动灵敏度过高的问题。</p>
|
||||
<h2>0.6.0-fix.1</h2>
|
||||
|
||||
@ -56,6 +56,12 @@
|
||||
|
||||
## 方法
|
||||
|
||||
### hasCustomStyle()
|
||||
|
||||
> v0.6.2+
|
||||
|
||||
获取是否设置了自定义样式。
|
||||
|
||||
### getSize()
|
||||
|
||||
通过重新创建节点内容更新节点的宽高,返回一个布尔值,代表是否宽高发生了变化
|
||||
|
||||
@ -31,6 +31,11 @@
|
||||
</blockquote>
|
||||
<p>节点是否正在拖拽中</p>
|
||||
<h2>方法</h2>
|
||||
<h3>hasCustomStyle()</h3>
|
||||
<blockquote>
|
||||
<p>v0.6.2+</p>
|
||||
</blockquote>
|
||||
<p>获取是否设置了自定义样式。</p>
|
||||
<h3>getSize()</h3>
|
||||
<p>通过重新创建节点内容更新节点的宽高,返回一个布尔值,代表是否宽高发生了变化</p>
|
||||
<h3>render()</h3>
|
||||
|
||||
Loading…
Reference in New Issue
Block a user