mirror of
https://github.com/barsdeveloper/ueblueprint.git
synced 2026-03-05 15:17:32 +08:00
Closeable color picker window
This commit is contained in:
@@ -3,14 +3,15 @@ import ObjectSerializer from "../../serialization/ObjectSerializer"
|
||||
|
||||
export default class Copy extends IInput {
|
||||
|
||||
static #serializer = new ObjectSerializer()
|
||||
|
||||
/** @type {(e: ClipboardEvent) => void} */
|
||||
#copyHandler
|
||||
|
||||
constructor(target, blueprint, options = {}) {
|
||||
options.listenOnFocus = true
|
||||
options.unlistenOnTextEdit = true // No nodes copy if inside a text field, just text (default behavior)
|
||||
options.listenOnFocus ??= true
|
||||
options.unlistenOnTextEdit ??= true // No nodes copy if inside a text field, just text (default behavior)
|
||||
super(target, blueprint, options)
|
||||
this.serializer = new ObjectSerializer()
|
||||
let self = this
|
||||
this.#copyHandler = _ => self.copied()
|
||||
}
|
||||
@@ -24,7 +25,10 @@ export default class Copy extends IInput {
|
||||
}
|
||||
|
||||
copied() {
|
||||
const value = this.blueprint.getNodes(true).map(node => this.serializer.serialize(node.entity, false)).join("\n\n")
|
||||
const value = this.blueprint
|
||||
.getNodes(true)
|
||||
.map(node => Copy.#serializer.serialize(node.entity, false))
|
||||
.join("\n\n")
|
||||
navigator.clipboard.writeText(value)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user