mirror of
https://github.com/Pomax/BezierInfo-2.git
synced 2025-09-29 01:29:03 +02:00
control (#261)
This commit is contained in:
@@ -35,7 +35,8 @@ class GraphicsElement extends CustomElement {
|
||||
:host style { display: none; }
|
||||
:host canvas { display: block; margin: auto; border-radius: 0; }
|
||||
:host canvas:focus { ${
|
||||
this.getAttribute(`focus-css`) || `border: 1px solid red !important; margin: -1px; `
|
||||
this.getAttribute(`focus-css`) ||
|
||||
`border: 1px solid red !important; margin: -1px; `
|
||||
} }
|
||||
:host a.view-source { float: left; font-size: 60%; text-decoration: none; }
|
||||
:host label { display: block; font-style:italic; font-size: 0.9em; text-align: right; }
|
||||
@@ -160,7 +161,9 @@ class GraphicsElement extends CustomElement {
|
||||
|
||||
const script = (this.script = document.createElement(`script`));
|
||||
script.type = "module";
|
||||
script.src = `data:application/javascript;charset=utf-8,${encodeURIComponent(this.code)}`;
|
||||
script.src = `data:application/javascript;charset=utf-8,${encodeURIComponent(
|
||||
this.code
|
||||
)}`;
|
||||
if (rerender) this.render();
|
||||
}
|
||||
|
||||
@@ -219,10 +222,12 @@ class GraphicsElement extends CustomElement {
|
||||
if (this.canvas) slotParent.insertBefore(this.canvas, this._slot);
|
||||
if (this.label) slotParent.insertBefore(this.label, this._slot);
|
||||
|
||||
const a = document.createElement('a');
|
||||
a.classList.add('view-source');
|
||||
const a = document.createElement("a");
|
||||
a.classList.add("view-source");
|
||||
a.textContent = `view source`;
|
||||
a.href = new URL(`data:text/plain;charset=utf-8,${encodeURIComponent(this.rawCode)}`);
|
||||
a.href = new URL(
|
||||
`data:text/plain;charset=utf-8,${encodeURIComponent(this.rawCode)}`
|
||||
);
|
||||
a.target = `_blank`;
|
||||
if (this.label) slotParent.insertBefore(a, this.label);
|
||||
}
|
||||
|
Reference in New Issue
Block a user