Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
liangzhen
/
framework-tools-web
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit 1babd22f
authored
Nov 28, 2023
by
liuyong
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改bug
1 parent
5679bde9
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
83 additions
and
22 deletions
public/drawio/js/grapheditor/Dialogs.js
public/drawio/js/grapheditor/Format.js
public/drawio/js/grapheditor/Dialogs.js
View file @
1babd22
...
...
@@ -1744,6 +1744,7 @@ var EditDataDialog = function(ui, cell)
var
applyBtn
=
mxUtils
.
button
(
mxResources
.
get
(
'apply'
),
function
()
{
//二次开发,编辑数据的时候点击应用时候的操作
try
{
ui
.
hideDialog
.
apply
(
ui
,
arguments
);
...
...
public/drawio/js/grapheditor/Format.js
View file @
1babd22
...
...
@@ -1547,34 +1547,93 @@ AttributePanel = function(format, editorUi, container)
}
mxUtils
.
extend
(
AttributePanel
,
BaseFormatPanel
);
AttributePanel
.
prototype
.
init
=
function
()
AttributePanel
.
prototype
.
init
=
function
()
//二次开发,属性面板内容
{
console
.
log
(
'属性面板'
);
var
ss
=
this
.
editorUi
.
getSelectionState
();
const
nodeInfo
=
ss
.
cells
[
0
].
value
;
const
nodeName
=
typeof
nodeInfo
==
'string'
?
nodeInfo
:
'节点名称'
;
var
ui
=
this
.
editorUi
;
var
editor
=
ui
.
editor
;
var
graph
=
editor
.
graph
;
// var ss = this.editorUi.getSelectionState();
const
objectTag
=
graph
.
getSelectionCell
().
value
;
const
nodeName
=
typeof
objectTag
==
'string'
?
objectTag
:
objectTag
.
getAttribute
(
'label'
);
var
div
=
document
.
createElement
(
'div'
);
div
.
style
.
padding
=
'8px'
;
if
(
typeof
nodeInfo
==
'string'
)
{
div
.
innerHTML
=
`
<div>节点名称: <span>
${
nodeName
}
</span></div>
`
;
}
else
{
// console.log(ss);
let
resHtml
=
''
;
for
(
const
key
in
nodeInfo
.
attributes
){
if
(
nodeInfo
.
attributes
.
hasOwnProperty
(
key
))
{
// console.log(nodeInfo.attributes[key].name);
// console.log(nodeInfo.attributes[key].value);
div
.
style
.
cssText
=
'padding: 8px;display: flex;align-items: center;justify-content: space-around;'
;
resHtml
+=
`<div>
${
nodeInfo
.
attributes
[
key
].
name
}
:
${
nodeInfo
.
attributes
[
key
].
value
}
</div>`
;
}
}
// console.log(resHtml);
div
.
innerHTML
=
resHtml
;
}
const
div2
=
document
.
createElement
(
'div'
);
div2
.
innerHTML
=
'节点名称: '
;
div
.
appendChild
(
div2
);
const
input
=
document
.
createElement
(
"input"
);
input
.
type
=
"text"
;
input
.
value
=
nodeName
;
input
.
addEventListener
(
"blur"
,
function
(
e
)
{
const
value_
=
e
.
target
.
value
;
graph
.
getModel
().
setValue
(
graph
.
getSelectionCell
(),
value_
);
//修改节点名称
});
div
.
appendChild
(
input
);
this
.
container
.
appendChild
(
div
);
if
(
typeof
objectTag
==
'object'
)
{
this
.
addListPanel
(
this
.
container
);
}
}
AttributePanel
.
prototype
.
addListPanel
=
function
(
container
)
{
var
ui
=
this
.
editorUi
;
var
editor
=
ui
.
editor
;
var
graph
=
editor
.
graph
;
const
div
=
document
.
createElement
(
'div'
);
const
objectTag
=
graph
.
getSelectionCell
().
value
;
const
attributeArr
=
Array
.
from
(
objectTag
.
attributes
);
attributeArr
.
shift
();
//去掉节点名称
const
nodeName
=
attributeArr
.
map
(
attr
=>
attr
.
name
);
const
nodeValue
=
attributeArr
.
map
(
attr
=>
attr
.
value
);
nodeName
.
forEach
((
item
,
index
)
=>
{
const
itemContainer
=
document
.
createElement
(
'div'
);
itemContainer
.
style
.
display
=
'flex'
;
itemContainer
.
style
.
alignItems
=
'center'
;
itemContainer
.
style
.
justifyContent
=
'space-around'
;
const
nameDiv
=
document
.
createElement
(
'div'
);
nameDiv
.
innerHTML
=
item
+
': '
;
itemContainer
.
appendChild
(
nameDiv
);
const
input
=
document
.
createElement
(
"input"
);
input
.
type
=
"text"
;
input
.
value
=
nodeValue
[
index
];
input
.
addEventListener
(
"blur"
,
function
(
e
)
{
const
value_
=
e
.
target
.
value
;
objectTag
.
setAttribute
(
item
,
value_
);
});
itemContainer
.
appendChild
(
input
);
div
.
appendChild
(
itemContainer
);
})
// input.addEventListener("blur", function(e) {
// const value_ = e.target.value;
// const ObjectTag = graph.getSelectionCell().value;
// ObjectTag.setAttribute('age', value_);
// });
// div.appendChild(input);
container
.
appendChild
(
div
);
}
/**
* Adds the label menu items to the given menu and parent.
...
...
@@ -2056,6 +2115,7 @@ ArrangePanel.prototype.addDistribute = function(div)
*/
ArrangePanel
.
prototype
.
addAngle
=
function
(
div
)
{
var
ui
=
this
.
editorUi
;
var
editor
=
ui
.
editor
;
var
graph
=
editor
.
graph
;
...
...
Write
Preview
Markdown
is supported
Attach a file
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to post a comment