Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: remove codemirror references in colorPreview extension #1977

Merged
merged 2 commits into from
Dec 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ on:
jobs:
analyze:
name: Analyze
runs-on: ubuntu-latest
runs-on: ubuntu-22.04
permissions:
actions: read
contents: read
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/comment_pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ on:

jobs:
one:
runs-on: ubuntu-latest
runs-on: ubuntu-22.04
strategy:
matrix:
python-version: [3.8]
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/create-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ on:

jobs:
build-tasks:
runs-on: ubuntu-latest
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v3
- name: setup node
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/desktop-linux-prod-test-pull.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ concurrency:

jobs:
test-desktop-linux-prod:
runs-on: ubuntu-latest
runs-on: ubuntu-22.04
timeout-minutes: 90
steps:
- uses: actions/checkout@v3
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/desktop-linux-test-pull.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ concurrency:

jobs:
test-desktop-linux:
runs-on: ubuntu-latest
runs-on: ubuntu-22.04
timeout-minutes: 90
steps:
- uses: actions/checkout@v3
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/dev-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ on:

jobs:
build-tasks:
runs-on: ubuntu-latest
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v3
- name: Npm Install
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/minor-version-bump.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ on:

jobs:
build-tasks:
runs-on: ubuntu-latest
runs-on: ubuntu-22.04
steps:
- name: setup node
uses: actions/setup-node@v3
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/patch-version-bump.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ on:

jobs:
build-tasks:
runs-on: ubuntu-latest
runs-on: ubuntu-22.04
steps:
- name: setup node
uses: actions/setup-node@v3
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/playwright-chromium-linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ concurrency:
jobs:
playwright-chromium-linux:
timeout-minutes: 90
runs-on: ubuntu-latest
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v3
- name: setup node
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/playwright-firefox-linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ concurrency:
jobs:
playwright-firefox-linux:
timeout-minutes: 90
runs-on: ubuntu-latest
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v3
- name: setup node
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/playwright-staging-prod.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ on:
jobs:
playwrightChromiumLinux:
timeout-minutes: 90
runs-on: ubuntu-latest
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v3
- name: setup node
Expand Down Expand Up @@ -166,7 +166,7 @@ jobs:

playwrightFirefoxLinux:
timeout-minutes: 90
runs-on: ubuntu-latest
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v3
- name: setup node
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/prod-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ on:

jobs:
build-tasks:
runs-on: ubuntu-latest
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v3
- name: setup node
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/pull_request_verify.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ on:

jobs:
build-tasks:
runs-on: ubuntu-latest
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v3
- name: setup node
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/staging-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ on:

jobs:
build-tasks:
runs-on: ubuntu-latest
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v3
- name: setup node
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/tauri-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ on:

jobs:
build-tasks:
runs-on: ubuntu-latest
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v3
- name: setup node
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/tranlate-languages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ on:

jobs:
build-tasks:
runs-on: ubuntu-latest
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v3
- name: Building phoenix
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/verify_cla_signature_pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ on:

jobs:
one:
runs-on: ubuntu-latest
runs-on: ubuntu-22.04
strategy:
matrix:
python-version: [3.8]
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/yearly-major-version-bump.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ on:

jobs:
build-tasks:
runs-on: ubuntu-latest
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v3
with:
Expand Down
27 changes: 8 additions & 19 deletions src/extensionsIntegrated/CSSColorPreview/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,6 @@ define(function (require, exports, module) {
*/
function showGutters(editor, _results, update = false) {
if (editor && enabled) {
const cm = editor._codeMirror;
// if the file is updated we don't need to clear the gutter
// as it will clear all the existing markers.
if(!update) {
Expand All @@ -132,9 +131,9 @@ define(function (require, exports, module) {

// Only add markers if enabled
if (enabled) {
cm.colorGutters = _.sortBy(_results, "lineNumber");
const colorGutters = _.sortBy(_results, "lineNumber");

cm.colorGutters.forEach(function (obj) {
colorGutters.forEach(function (obj) {
let $marker;
if (obj.colorValues.length === 1) {
// Single color preview
Expand Down Expand Up @@ -213,18 +212,10 @@ define(function (require, exports, module) {
newEditor.on("cursorActivity.colorPreview", _cursorActivity);
// Unbind the previous editor's change event if it exists
if (oldEditor) {
const oldCM = oldEditor._codeMirror;
if (oldCM) {
oldCM.off("change", onChanged);
}
}

// Bind change event to the new editor
const cm = newEditor._codeMirror;
if (cm) {
cm.on("change", onChanged);
oldEditor.off("change", onChanged);
}

newEditor.off("change", onChanged);
newEditor.on("change", onChanged);
showColorMarks();
_cursorActivity(null, newEditor);
}
Expand All @@ -233,13 +224,11 @@ define(function (require, exports, module) {
// Handle the currently active editor at initialization
const activeEditor = EditorManager.getActiveEditor();
if (activeEditor) {
const cm = activeEditor._codeMirror;
if (cm) {
cm.on("change", onChanged);
}
activeEditor.off("change", onChanged);
activeEditor.on("change", onChanged);
showColorMarks();
_cursorActivity(null, activeEditor);
}

}

/**
Expand Down
Loading