Address submission release checks

This commit is contained in:
Nymbo 2026-05-12 17:19:18 -04:00
parent abb1cd956a
commit d8a5d19576
7 changed files with 78 additions and 21 deletions

52
.github/workflows/release.yml vendored Normal file
View file

@ -0,0 +1,52 @@
name: Release
on:
push:
tags:
- "*.*.*"
permissions:
contents: write
id-token: write
attestations: write
jobs:
release:
runs-on: ubuntu-latest
steps:
- name: Check out repository
uses: actions/checkout@v4
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: 22
cache: npm
- name: Install dependencies
run: npm ci --force
- name: Build
run: npm run build
- name: Lint
run: npm run lint
- name: Generate artifact attestations
uses: actions/attest@v4
with:
subject-path: |
main.js
manifest.json
styles.css
- name: Create GitHub release
env:
GH_TOKEN: ${{ github.token }}
run: |
gh release create "${GITHUB_REF_NAME}" main.js manifest.json styles.css \
--repo "${GITHUB_REPOSITORY}" \
--title "${GITHUB_REF_NAME}" \
--notes "Release ${GITHUB_REF_NAME}" \
--verify-tag

View file

@ -8,6 +8,8 @@ export default tseslint.config(
languageOptions: {
globals: {
...globals.browser,
activeDocument: "readonly",
activeWindow: "readonly",
},
parserOptions: {
projectService: {

View file

@ -1,8 +1,8 @@
{
"id": "copy-highlighter",
"name": "Copy Highlighter",
"version": "0.2.1",
"minAppVersion": "0.16.0",
"version": "0.2.2",
"minAppVersion": "1.0.0",
"description": "Highlights copied text.",
"author": "Nymbo",
"authorUrl": "https://github.com/Nymbo",

4
package-lock.json generated
View file

@ -1,12 +1,12 @@
{
"name": "copy-highlighter",
"version": "0.2.1",
"version": "0.2.2",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "copy-highlighter",
"version": "0.2.1",
"version": "0.2.2",
"license": "MIT",
"dependencies": {
"@codemirror/state": "^6.6.0",

View file

@ -1,6 +1,6 @@
{
"name": "copy-highlighter",
"version": "0.2.1",
"version": "0.2.2",
"description": "Highlights copied text.",
"main": "main.js",
"type": "module",

View file

@ -224,35 +224,35 @@ export default class CopyHighlighterPlugin extends Plugin {
this.registerEditorExtension(copyFlashExtension(this.highlightSession));
this.registerDomEvent(document, "keydown", (event) => {
this.registerDomEvent(activeDocument, "keydown", (event) => {
this.highlightSession.handleKeyDown(event);
}, true);
this.registerDomEvent(document, "keyup", (event) => {
this.registerDomEvent(activeDocument, "keyup", (event) => {
this.highlightSession.handleKeyUp(event);
}, true);
this.registerDomEvent(window, "blur", () => {
this.registerDomEvent(activeWindow, "blur", () => {
this.highlightSession.resetKeys();
});
this.registerDomEvent(document, "visibilitychange", () => {
if (document.visibilityState === "hidden") {
this.registerDomEvent(activeDocument, "visibilitychange", () => {
if (activeDocument.visibilityState === "hidden") {
this.highlightSession.resetKeys();
}
});
// CodeMirror handles editor selections. This fallback covers copied text in
// rendered Markdown or other Obsidian-owned DOM content.
this.registerDomEvent(document, "copy", (event) => {
this.registerDomEvent(activeDocument, "copy", (event) => {
this.flashDomSelection(event);
}, true);
}
onunload() {
this.clearDomHighlights();
document.body.style.removeProperty("--copy-highlighter-editor-background");
document.body.style.removeProperty("--copy-highlighter-border-radius");
activeDocument.body.style.removeProperty("--copy-highlighter-editor-background");
activeDocument.body.style.removeProperty("--copy-highlighter-border-radius");
}
private flashDomSelection(event: ClipboardEvent) {
@ -270,7 +270,7 @@ export default class CopyHighlighterPlugin extends Plugin {
return;
}
const selection = window.getSelection();
const selection = target.ownerDocument.getSelection();
if (selection === null || selection.isCollapsed || selection.rangeCount === 0) {
return;
@ -299,11 +299,13 @@ export default class CopyHighlighterPlugin extends Plugin {
.slice(0, MAX_DOM_FLASH_RECTS);
for (const rect of rects) {
const overlay = document.createElement("div");
const ownerDocument = range.commonAncestorContainer.ownerDocument ?? activeDocument;
const ownerWindow = ownerDocument.defaultView ?? activeWindow;
const overlay = ownerDocument.createElement("div");
overlay.className = "copy-highlighter-dom-highlight";
overlay.style.left = `${rect.left + window.scrollX}px`;
overlay.style.top = `${rect.top + window.scrollY}px`;
overlay.style.left = `${rect.left + ownerWindow.scrollX}px`;
overlay.style.top = `${rect.top + ownerWindow.scrollY}px`;
overlay.style.width = `${rect.width}px`;
overlay.style.height = `${rect.height}px`;
overlay.style.backgroundColor = hexToRgba(
@ -312,7 +314,7 @@ export default class CopyHighlighterPlugin extends Plugin {
);
overlay.style.borderRadius = `${this.settings.borderRadius}px`;
document.body.appendChild(overlay);
ownerDocument.body.appendChild(overlay);
this.domHighlights.add(overlay);
}
}
@ -340,11 +342,11 @@ export default class CopyHighlighterPlugin extends Plugin {
}
private applyCssVariables() {
document.body.style.setProperty(
activeDocument.body.style.setProperty(
"--copy-highlighter-editor-background",
hexToRgba(this.settings.highlightColor, this.settings.editorOpacity)
);
document.body.style.setProperty(
activeDocument.body.style.setProperty(
"--copy-highlighter-border-radius",
`${this.settings.borderRadius}px`
);

View file

@ -4,5 +4,6 @@
"0.1.2": "0.16.0",
"0.1.3": "0.16.0",
"0.2.0": "0.16.0",
"0.2.1": "0.16.0"
"0.2.1": "1.0.0",
"0.2.2": "1.0.0"
}