mirror of
https://github.com/barsdeveloper/ueblueprint.git
synced 2026-05-18 03:27:32 +08:00
Fixed console errors
This commit is contained in:
32
dist/ueblueprint.js
vendored
32
dist/ueblueprint.js
vendored
@@ -1978,7 +1978,7 @@ class IElement extends HTMLElement {
|
|||||||
* @returns {V}
|
* @returns {V}
|
||||||
*/
|
*/
|
||||||
getInputObject(type) {
|
getInputObject(type) {
|
||||||
return /** @type {V} */ (this.inputObjects.find(object => object.constructor == type))
|
return /** @type {V} */ (this.template.inputObjects.find(object => object.constructor == type))
|
||||||
}
|
}
|
||||||
|
|
||||||
// Subclasses will want to override
|
// Subclasses will want to override
|
||||||
@@ -2824,13 +2824,7 @@ class StringPinTemplate extends PinTemplate {
|
|||||||
renderInput(pin) {
|
renderInput(pin) {
|
||||||
return html`
|
return html`
|
||||||
<div class="ueb-pin-input">
|
<div class="ueb-pin-input">
|
||||||
<div class="ueb-pin-input-content" role="textbox" contenteditable="true"
|
<div class="ueb-pin-input-content" role="textbox" contenteditable="true"></div>
|
||||||
onfocus="this.closest('ueb-blueprint')?.dispatchEditTextEvent(true)"
|
|
||||||
onfocusout="
|
|
||||||
this.closest('ueb-blueprint')?.dispatchEditTextEvent(false)
|
|
||||||
document.getSelection().removeAllRanges()
|
|
||||||
"
|
|
||||||
></div>
|
|
||||||
</div>
|
</div>
|
||||||
`
|
`
|
||||||
}
|
}
|
||||||
@@ -2841,15 +2835,17 @@ class StringPinTemplate extends PinTemplate {
|
|||||||
setup(pin) {
|
setup(pin) {
|
||||||
super.setup(pin);
|
super.setup(pin);
|
||||||
const input = pin.querySelector(".ueb-pin-input-content");
|
const input = pin.querySelector(".ueb-pin-input-content");
|
||||||
this.onFocusHandler = () => {
|
if (input) {
|
||||||
pin.blueprint.dispatchEditTextEvent(true);
|
this.onFocusHandler = () => {
|
||||||
};
|
pin.blueprint.dispatchEditTextEvent(true);
|
||||||
this.onFocusOutHandler = () => {
|
};
|
||||||
pin.blueprint.dispatchEditTextEvent(false);
|
this.onFocusOutHandler = () => {
|
||||||
document.getSelection().removeAllRanges(); // Deselect text inside the input
|
pin.blueprint.dispatchEditTextEvent(false);
|
||||||
};
|
document.getSelection().removeAllRanges(); // Deselect text inside the input
|
||||||
input.addEventListener("onfocus", this.onFocusHandler);
|
};
|
||||||
input.addEventListener("onfocusout", this.onFocusOutHandler);
|
input.addEventListener("onfocus", this.onFocusHandler);
|
||||||
|
input.addEventListener("onfocusout", this.onFocusOutHandler);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -3092,7 +3088,7 @@ class SelectableDraggableTemplate extends ITemplate {
|
|||||||
return [
|
return [
|
||||||
...super.createInputObjects(element),
|
...super.createInputObjects(element),
|
||||||
...[
|
...[
|
||||||
new MouseMoveNodes(this, element.blueprint, {
|
new MouseMoveNodes(element, element.blueprint, {
|
||||||
looseTarget: true
|
looseTarget: true
|
||||||
}),
|
}),
|
||||||
]
|
]
|
||||||
|
|||||||
@@ -81,7 +81,7 @@ export default class IElement extends HTMLElement {
|
|||||||
* @returns {V}
|
* @returns {V}
|
||||||
*/
|
*/
|
||||||
getInputObject(type) {
|
getInputObject(type) {
|
||||||
return /** @type {V} */ (this.inputObjects.find(object => object.constructor == type))
|
return /** @type {V} */ (this.template.inputObjects.find(object => object.constructor == type))
|
||||||
}
|
}
|
||||||
|
|
||||||
// Subclasses will want to override
|
// Subclasses will want to override
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ export default class SelectableDraggableTemplate extends ITemplate {
|
|||||||
return [
|
return [
|
||||||
...super.createInputObjects(element),
|
...super.createInputObjects(element),
|
||||||
...[
|
...[
|
||||||
new MouseMoveNodes(this, element.blueprint, {
|
new MouseMoveNodes(element, element.blueprint, {
|
||||||
looseTarget: true
|
looseTarget: true
|
||||||
}),
|
}),
|
||||||
]
|
]
|
||||||
|
|||||||
@@ -19,13 +19,7 @@ export default class StringPinTemplate extends PinTemplate {
|
|||||||
renderInput(pin) {
|
renderInput(pin) {
|
||||||
return html`
|
return html`
|
||||||
<div class="ueb-pin-input">
|
<div class="ueb-pin-input">
|
||||||
<div class="ueb-pin-input-content" role="textbox" contenteditable="true"
|
<div class="ueb-pin-input-content" role="textbox" contenteditable="true"></div>
|
||||||
onfocus="this.closest('ueb-blueprint')?.dispatchEditTextEvent(true)"
|
|
||||||
onfocusout="
|
|
||||||
this.closest('ueb-blueprint')?.dispatchEditTextEvent(false)
|
|
||||||
document.getSelection().removeAllRanges()
|
|
||||||
"
|
|
||||||
></div>
|
|
||||||
</div>
|
</div>
|
||||||
`
|
`
|
||||||
}
|
}
|
||||||
@@ -36,15 +30,17 @@ export default class StringPinTemplate extends PinTemplate {
|
|||||||
setup(pin) {
|
setup(pin) {
|
||||||
super.setup(pin)
|
super.setup(pin)
|
||||||
const input = pin.querySelector(".ueb-pin-input-content")
|
const input = pin.querySelector(".ueb-pin-input-content")
|
||||||
this.onFocusHandler = () => {
|
if (input) {
|
||||||
pin.blueprint.dispatchEditTextEvent(true)
|
this.onFocusHandler = () => {
|
||||||
|
pin.blueprint.dispatchEditTextEvent(true)
|
||||||
|
}
|
||||||
|
this.onFocusOutHandler = () => {
|
||||||
|
pin.blueprint.dispatchEditTextEvent(false)
|
||||||
|
document.getSelection().removeAllRanges() // Deselect text inside the input
|
||||||
|
}
|
||||||
|
input.addEventListener("onfocus", this.onFocusHandler)
|
||||||
|
input.addEventListener("onfocusout", this.onFocusOutHandler)
|
||||||
}
|
}
|
||||||
this.onFocusOutHandler = () => {
|
|
||||||
pin.blueprint.dispatchEditTextEvent(false)
|
|
||||||
document.getSelection().removeAllRanges() // Deselect text inside the input
|
|
||||||
}
|
|
||||||
input.addEventListener("onfocus", this.onFocusHandler)
|
|
||||||
input.addEventListener("onfocusout", this.onFocusOutHandler)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Reference in New Issue
Block a user