Skip to content

Commit

Permalink
fix: unselectLink before selection
Browse files Browse the repository at this point in the history
  • Loading branch information
SSShooter committed Oct 3, 2023
1 parent 1e55e9a commit 1ab8be0
Show file tree
Hide file tree
Showing 6 changed files with 10 additions and 2 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "mind-elixir",
"version": "3.2.1",
"version": "3.2.2",
"type": "module",
"description": "Mind elixir is a free open source mind map core.",
"keywords": [
Expand Down
5 changes: 5 additions & 0 deletions src/customLink.ts
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,11 @@ export const selectLink = function (this: MindElixirInstance, link: CustomSvg) {
this.showLinkController(obj, fromData, toData)
}

export const unselectLink = function (this: MindElixirInstance) {
this.currentLink = null
this.hideLinkController()
}

export const hideLinkController = function (this: MindElixirInstance) {
this.linkController.style.display = 'none'
this.P2.style.display = 'none'
Expand Down
2 changes: 1 addition & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ MindElixir.DARK_THEME = DARK_THEME
* @memberof MindElixir
* @static
*/
MindElixir.version = '3.2.1'
MindElixir.version = '3.2.2'
/**
* @function
* @memberof MindElixir
Expand Down
1 change: 1 addition & 0 deletions src/mouse.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ export default function (mind: MindElixirInstance) {
mind.unselectNode()
mind.unselectNodes()
mind.unselectSummary()
mind.unselectLink()
// e.preventDefault() // can cause <a /> tags don't work
const target = e.target as any
if (target.tagName === 'ME-EPD') {
Expand Down
1 change: 1 addition & 0 deletions src/plugin/keypress.ts
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,7 @@ export default function (mind: MindElixirInstance) {
}
if (e.keyCode === 8 || e.keyCode === 46) {
// del,backspace
// bug
if (mind.currentLink) mind.removeLink()
else if (mind.currentSummary) mind.removeSummary(mind.currentSummary.summaryObj.id)
else mind.removeNode()
Expand Down
1 change: 1 addition & 0 deletions src/plugin/selection.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ export default function (mei: MindElixirInstance) {
mei.unselectNode()
mei.unselectNodes()
mei.unselectSummary()
mei.unselectLink()
selection.clearSelection(true, true)
}
})
Expand Down

0 comments on commit 1ab8be0

Please sign in to comment.