mirror of
https://github.com/barsdeveloper/ueblueprint.git
synced 2026-03-12 11:07:40 +08:00
Refactoring
This commit is contained in:
@@ -24,20 +24,20 @@ export default class PinTemplate extends ITemplate {
|
||||
render(pin) {
|
||||
if (pin.isInput()) {
|
||||
return html`
|
||||
<span class="ueb-pin-icon">
|
||||
<div class="ueb-pin-icon">
|
||||
${this.renderIcon(pin)}
|
||||
</span>
|
||||
<span class="ueb-pin-content">
|
||||
</div>
|
||||
<div class="ueb-pin-content">
|
||||
<span class="ueb-pin-name">${sanitizeText(pin.getPinDisplayName())}</span>
|
||||
${this.renderInput(pin)}
|
||||
</span>
|
||||
</div>
|
||||
`
|
||||
} else {
|
||||
return html`
|
||||
<span class="ueb-pin-name">${sanitizeText(pin.getPinDisplayName())}</span>
|
||||
<span class="ueb-pin-icon">
|
||||
<div class="ueb-pin-name">${sanitizeText(pin.getPinDisplayName())}</div>
|
||||
<div class="ueb-pin-icon">
|
||||
${this.renderIcon(pin)}
|
||||
</span>
|
||||
</div>
|
||||
`
|
||||
}
|
||||
}
|
||||
@@ -71,7 +71,7 @@ export default class PinTemplate extends ITemplate {
|
||||
pin.dataset.advancedView = "true"
|
||||
}
|
||||
pin.clickableElement = pin
|
||||
window.customElements.whenDefined("ueb-node").then(pin.nodeElement = pin.closest("ueb-node"))
|
||||
window.customElements.whenDefined("ueb-node").then(_ => pin.nodeElement = pin.closest("ueb-node"))
|
||||
pin.getLinks().forEach(pinReference => {
|
||||
const targetPin = pin.blueprint.getPin(pinReference)
|
||||
if (targetPin) {
|
||||
|
||||
@@ -16,14 +16,16 @@ export default class StringPinTemplate extends PinTemplate {
|
||||
* @param {PinElement} pin
|
||||
*/
|
||||
renderInput(pin) {
|
||||
const stopEventPropagation = "e => stopPropagation()"
|
||||
return html`
|
||||
<span class="ueb-pin-input">
|
||||
<span class="ueb-pin-input-content" role="textbox" contenteditable="true"
|
||||
<div class="ueb-pin-input">
|
||||
<div class="ueb-pin-input-content" role="textbox" contenteditable="true"
|
||||
onfocus="this.closest('ueb-blueprint')?.dispatchEditTextEvent(true)"
|
||||
onfocusout="this.closest('ueb-blueprint')?.dispatchEditTextEvent(false)"
|
||||
></span>
|
||||
</span>
|
||||
onfocusout="
|
||||
this.closest('ueb-blueprint')?.dispatchEditTextEvent(false)
|
||||
document.getSelection().removeAllRanges()
|
||||
"
|
||||
></div>
|
||||
</div>
|
||||
`
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user