ep_themes 11.0.16 → 11.0.17
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.github/workflows/backend-tests.yml +4 -4
- package/.github/workflows/frontend-tests.yml +4 -4
- package/.github/workflows/npmpublish.yml +12 -4
- package/README.md +17 -1
- package/ep.json +3 -1
- package/index.js +9 -0
- package/package.json +2 -2
- package/static/js/init.js +7 -0
- package/static/js/themes.js +191 -43
- package/templates/themesMenu.ejs +1 -1
|
@@ -22,11 +22,11 @@ jobs:
|
|
|
22
22
|
version: 1.0
|
|
23
23
|
-
|
|
24
24
|
name: Install etherpad core
|
|
25
|
-
uses: actions/checkout@
|
|
25
|
+
uses: actions/checkout@v6
|
|
26
26
|
with:
|
|
27
27
|
repository: ether/etherpad-lite
|
|
28
28
|
path: etherpad-lite
|
|
29
|
-
- uses: pnpm/action-setup@
|
|
29
|
+
- uses: pnpm/action-setup@v6
|
|
30
30
|
name: Install pnpm
|
|
31
31
|
with:
|
|
32
32
|
version: 10
|
|
@@ -35,7 +35,7 @@ jobs:
|
|
|
35
35
|
shell: bash
|
|
36
36
|
run: |
|
|
37
37
|
echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV
|
|
38
|
-
- uses: actions/cache@
|
|
38
|
+
- uses: actions/cache@v5
|
|
39
39
|
name: Setup pnpm cache
|
|
40
40
|
with:
|
|
41
41
|
path: ${{ env.STORE_PATH }}
|
|
@@ -44,7 +44,7 @@ jobs:
|
|
|
44
44
|
${{ runner.os }}-pnpm-store-
|
|
45
45
|
-
|
|
46
46
|
name: Checkout plugin repository
|
|
47
|
-
uses: actions/checkout@
|
|
47
|
+
uses: actions/checkout@v6
|
|
48
48
|
with:
|
|
49
49
|
path: plugin
|
|
50
50
|
- name: Remove tests
|
|
@@ -12,10 +12,10 @@ jobs:
|
|
|
12
12
|
steps:
|
|
13
13
|
-
|
|
14
14
|
name: Check out Etherpad core
|
|
15
|
-
uses: actions/checkout@
|
|
15
|
+
uses: actions/checkout@v6
|
|
16
16
|
with:
|
|
17
17
|
repository: ether/etherpad-lite
|
|
18
|
-
- uses: pnpm/action-setup@
|
|
18
|
+
- uses: pnpm/action-setup@v6
|
|
19
19
|
name: Install pnpm
|
|
20
20
|
with:
|
|
21
21
|
version: 10
|
|
@@ -24,7 +24,7 @@ jobs:
|
|
|
24
24
|
shell: bash
|
|
25
25
|
run: |
|
|
26
26
|
echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV
|
|
27
|
-
- uses: actions/cache@
|
|
27
|
+
- uses: actions/cache@v5
|
|
28
28
|
name: Setup pnpm cache
|
|
29
29
|
with:
|
|
30
30
|
path: ${{ env.STORE_PATH }}
|
|
@@ -33,7 +33,7 @@ jobs:
|
|
|
33
33
|
${{ runner.os }}-pnpm-store-
|
|
34
34
|
-
|
|
35
35
|
name: Check out the plugin
|
|
36
|
-
uses: actions/checkout@
|
|
36
|
+
uses: actions/checkout@v6
|
|
37
37
|
with:
|
|
38
38
|
path: ./node_modules/__tmp
|
|
39
39
|
-
|
|
@@ -31,7 +31,7 @@ jobs:
|
|
|
31
31
|
uses: actions/checkout@v6
|
|
32
32
|
with:
|
|
33
33
|
repository: ether/etherpad-lite
|
|
34
|
-
- uses: pnpm/action-setup@
|
|
34
|
+
- uses: pnpm/action-setup@v6
|
|
35
35
|
name: Install pnpm
|
|
36
36
|
with:
|
|
37
37
|
version: 10
|
|
@@ -59,12 +59,20 @@ jobs:
|
|
|
59
59
|
[ "${NEW_COMMITS}" -gt 0 ] || exit 0
|
|
60
60
|
git config user.name 'github-actions[bot]'
|
|
61
61
|
git config user.email '41898282+github-actions[bot]@users.noreply.github.com'
|
|
62
|
-
pnpm i
|
|
62
|
+
pnpm i --frozen-lockfile
|
|
63
63
|
# `pnpm version patch` bumps package.json, makes a commit, and creates
|
|
64
64
|
# a `v<new-version>` tag. Capture the new tag name from package.json
|
|
65
65
|
# rather than parsing pnpm's output, which has historically varied.
|
|
66
|
-
|
|
67
|
-
|
|
66
|
+
# Bump the patch component directly with Node. pnpm/action-setup@v6
|
|
67
|
+
# sometimes installs pnpm 11 pre-releases even when version: 10.x is
|
|
68
|
+
# requested (pnpm/action-setup#225); those pre-releases either skip
|
|
69
|
+
# the git commit/tag or reject --no-git-tag-version as unknown.
|
|
70
|
+
# Doing the bump in Node sidesteps both failure modes.
|
|
71
|
+
NEW_VERSION=$(node -e "const fs=require('fs');const p=require('./package.json');const v=p.version.split('.');v[2]=String(Number(v[2])+1);p.version=v.join('.');fs.writeFileSync('./package.json',JSON.stringify(p,null,2)+'\n');console.log(p.version);")
|
|
72
|
+
NEW_TAG="v${NEW_VERSION}"
|
|
73
|
+
git add package.json
|
|
74
|
+
git commit -m "${NEW_TAG}"
|
|
75
|
+
git tag -a "${NEW_TAG}" -m "${NEW_TAG}"
|
|
68
76
|
# CRITICAL: use --atomic so the branch update and the tag update
|
|
69
77
|
# succeed (or fail) as a single transaction on the server. The old
|
|
70
78
|
# `git push --follow-tags` was non-atomic per ref: if a concurrent
|
package/README.md
CHANGED
|
@@ -38,5 +38,21 @@ The following can optionally be added to your settings.json:
|
|
|
38
38
|
|
|
39
39
|
"ep_themes":{
|
|
40
40
|
"default_theme": "hacker"
|
|
41
|
-
}
|
|
41
|
+
}
|
|
42
42
|
|
|
43
|
+
## Installation
|
|
44
|
+
|
|
45
|
+
Install from the Etherpad admin UI (**Admin → Manage Plugins**,
|
|
46
|
+
search for `ep_themes` and click *Install*), or from the Etherpad
|
|
47
|
+
root directory:
|
|
48
|
+
|
|
49
|
+
```sh
|
|
50
|
+
pnpm run plugins install ep_themes
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
> ⚠️ Don't run `npm i` / `npm install` yourself from the Etherpad
|
|
54
|
+
> source tree — Etherpad tracks installed plugins through its own
|
|
55
|
+
> plugin-manager, and hand-editing `package.json` can leave the
|
|
56
|
+
> server unable to start.
|
|
57
|
+
|
|
58
|
+
After installing, restart Etherpad.
|
package/ep.json
CHANGED
|
@@ -3,11 +3,13 @@
|
|
|
3
3
|
{
|
|
4
4
|
"name": "ep_themes",
|
|
5
5
|
"client_hooks":{
|
|
6
|
-
"aceInitialized": "ep_themes/static/js/init"
|
|
6
|
+
"aceInitialized": "ep_themes/static/js/init",
|
|
7
|
+
"postTimesliderInit": "ep_themes/static/js/init"
|
|
7
8
|
},
|
|
8
9
|
"hooks":{
|
|
9
10
|
"clientVars":"ep_themes/index:clientVars",
|
|
10
11
|
"eejsBlock_scripts":"ep_themes/index:eejsBlock_scripts",
|
|
12
|
+
"eejsBlock_timesliderScripts":"ep_themes/index:eejsBlock_timesliderScripts",
|
|
11
13
|
"eejsBlock_mySettings.dropdowns":"ep_themes/index:eejsBlock_mySettings_dropdowns"
|
|
12
14
|
}
|
|
13
15
|
}
|
package/index.js
CHANGED
|
@@ -9,6 +9,15 @@ exports.eejsBlock_scripts = (hookName, args, cb) => {
|
|
|
9
9
|
cb();
|
|
10
10
|
};
|
|
11
11
|
|
|
12
|
+
// Inject the same script into the timeslider page so themes apply there too.
|
|
13
|
+
// Without this, /p/foo/timeslider always renders with the default theme even
|
|
14
|
+
// if the pad is set to (and persists) a different one (issue #68).
|
|
15
|
+
exports.eejsBlock_timesliderScripts = (hookName, args, cb) => {
|
|
16
|
+
args.content = `
|
|
17
|
+
<script src="../../static/plugins/ep_themes/static/js/themes.js"></script>${args.content}`;
|
|
18
|
+
cb();
|
|
19
|
+
};
|
|
20
|
+
|
|
12
21
|
exports.eejsBlock_mySettings_dropdowns = (hookName, args, cb) => {
|
|
13
22
|
args.content += eejs.require('ep_themes/templates/themesMenu.ejs');
|
|
14
23
|
cb();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ep_themes",
|
|
3
|
-
"version": "11.0.
|
|
3
|
+
"version": "11.0.17",
|
|
4
4
|
"description": "Change the themes, styles & colors of different parts of Etherpad Lite",
|
|
5
5
|
"author": {
|
|
6
6
|
"name": "John McLear",
|
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
},
|
|
28
28
|
"devDependencies": {
|
|
29
29
|
"eslint": "^8.57.1",
|
|
30
|
-
"eslint-config-etherpad": "^4.0.
|
|
30
|
+
"eslint-config-etherpad": "^4.0.5",
|
|
31
31
|
"typescript": "^6.0.2"
|
|
32
32
|
},
|
|
33
33
|
"scripts": {
|
package/static/js/init.js
CHANGED
|
@@ -3,3 +3,10 @@
|
|
|
3
3
|
exports.aceInitialized = (hook, context) => {
|
|
4
4
|
themes.init();
|
|
5
5
|
};
|
|
6
|
+
|
|
7
|
+
// Apply the saved theme to the timeslider too. Without this hook the
|
|
8
|
+
// theme dropdown's selection persists in the cookie but /p/foo/timeslider
|
|
9
|
+
// always loads with the default theme (issue #68).
|
|
10
|
+
exports.postTimesliderInit = (hook, context) => {
|
|
11
|
+
themes.init();
|
|
12
|
+
};
|
package/static/js/themes.js
CHANGED
|
@@ -1,54 +1,131 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
3
|
+
// Read/write the same cookie that ep_etherpad-lite's pad_cookie module manages.
|
|
4
|
+
// We can't `require('ep_etherpad-lite/static/js/pad_cookie')` from the plugin
|
|
5
|
+
// any more — Etherpad 2.x bundles its frontend with esbuild and no longer
|
|
6
|
+
// exposes a global `require()` in the page. So we talk to the cookie directly
|
|
7
|
+
// using the same name and JSON encoding that pad_cookie uses, which keeps the
|
|
8
|
+
// theme preference in sync with the rest of Etherpad's per-pad prefs.
|
|
9
|
+
const padPrefs = {
|
|
10
|
+
cookieName_: () => {
|
|
11
|
+
const prefix = (window.clientVars && window.clientVars.cookiePrefix) || '';
|
|
12
|
+
return prefix + (window.location.protocol === 'https:' ? 'prefs' : 'prefsHttp');
|
|
13
|
+
},
|
|
14
|
+
read_: () => {
|
|
15
|
+
try {
|
|
16
|
+
const name = padPrefs.cookieName_();
|
|
17
|
+
const raw = (document.cookie || '').split('; ')
|
|
18
|
+
.find((row) => row.startsWith(`${name}=`));
|
|
19
|
+
if (!raw) return {};
|
|
20
|
+
const json = decodeURIComponent(raw.slice(name.length + 1));
|
|
21
|
+
return JSON.parse(json) || {};
|
|
22
|
+
} catch (e) {
|
|
23
|
+
return {};
|
|
24
|
+
}
|
|
25
|
+
},
|
|
26
|
+
write_: (prefs) => {
|
|
27
|
+
const name = padPrefs.cookieName_();
|
|
28
|
+
const value = encodeURIComponent(JSON.stringify(prefs));
|
|
29
|
+
const expires = new Date(Date.now() + 365 * 24 * 60 * 60 * 1000).toUTCString();
|
|
30
|
+
const secure = window.location.protocol === 'https:' ? '; secure' : '';
|
|
31
|
+
document.cookie = `${name}=${value}; expires=${expires}; path=/; samesite=lax${secure}`;
|
|
32
|
+
},
|
|
33
|
+
getPref: (key) => padPrefs.read_()[key],
|
|
34
|
+
setPref: (key, value) => {
|
|
35
|
+
const prefs = padPrefs.read_();
|
|
36
|
+
prefs[key] = value;
|
|
37
|
+
padPrefs.write_(prefs);
|
|
38
|
+
},
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
// Captured lazily on first read so that loading themes.js from a <head>
|
|
42
|
+
// script (the timeslider page does this) doesn't crash on a missing
|
|
43
|
+
// document.body. The plugin's hooks fire after the editor is ready, so by
|
|
44
|
+
// the time we actually need these values the body exists.
|
|
45
|
+
let normal = null;
|
|
46
|
+
const captureNormal = () => {
|
|
47
|
+
if (normal) return normal;
|
|
48
|
+
if (!document.body) return null;
|
|
49
|
+
const bodyStyles = window.getComputedStyle(document.body);
|
|
50
|
+
normal = {
|
|
51
|
+
lightcolor: bodyStyles.getPropertyValue('--light-color'),
|
|
52
|
+
superdarkcolor: bodyStyles.getPropertyValue('--super-dark-color'),
|
|
53
|
+
darkcolor: bodyStyles.getPropertyValue('--dark-color'),
|
|
54
|
+
primarycolor: bodyStyles.getPropertyValue('--primary-color'),
|
|
55
|
+
middlecolor: bodyStyles.getPropertyValue('--middle-color'),
|
|
56
|
+
superlightcolor: bodyStyles.getPropertyValue('--super-light-color'),
|
|
57
|
+
textcolor: bodyStyles.getPropertyValue('--text-color'),
|
|
58
|
+
};
|
|
59
|
+
return normal;
|
|
60
|
+
};
|
|
12
61
|
|
|
13
62
|
const themes = {
|
|
14
63
|
change: () => {
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
64
|
+
const value = $('#themesmenu').val();
|
|
65
|
+
themes.setThemeByName(value);
|
|
66
|
+
padPrefs.setPref('themeName', value);
|
|
18
67
|
},
|
|
19
68
|
setTheme: (light, superDark, dark, primary, middle, text, superLight) => {
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
69
|
+
// Set the seven base colour vars on both <html> and <body>. <html> is
|
|
70
|
+
// important because the colibris skin's derived vars (--bg-color,
|
|
71
|
+
// --border-color, --text-soft-color, ...) live on selectors scoped to
|
|
72
|
+
// the <html> element (e.g. `.light-background`), and CSS variables
|
|
73
|
+
// don't propagate from <body> upward to <html>. Without setting them
|
|
74
|
+
// on <html> the timeslider stays in the default colibris colours.
|
|
75
|
+
const setBase = (style) => {
|
|
76
|
+
style.setProperty('--light-color', light);
|
|
77
|
+
style.setProperty('--super-dark-color', superDark);
|
|
78
|
+
style.setProperty('--dark-color', dark);
|
|
79
|
+
style.setProperty('--primary-color', primary);
|
|
80
|
+
style.setProperty('--middle-color', middle);
|
|
81
|
+
style.setProperty('--text-color', text);
|
|
82
|
+
style.setProperty('--super-light-color', superLight);
|
|
83
|
+
};
|
|
84
|
+
setBase(document.documentElement.style);
|
|
85
|
+
setBase(document.body.style);
|
|
86
|
+
|
|
87
|
+
// Pad page only: also re-apply inside the ace iframes. We set fewer vars
|
|
88
|
+
// on the iframes than on the top-level page on purpose — the cascade
|
|
89
|
+
// inside each iframe derives `--text-color` from `--super-dark-color`
|
|
90
|
+
// (via the `.light-background` rule on its own <html>), so explicitly
|
|
91
|
+
// setting `--text-color` to the `text` argument here would *override*
|
|
92
|
+
// that derivation and turn the editor text the wrong colour. Same for
|
|
93
|
+
// `--middle-color`. Stick to the colours that the iframe CSS reads
|
|
94
|
+
// directly.
|
|
95
|
+
const setIframeBase = (style) => {
|
|
96
|
+
style.setProperty('--primary-color', primary);
|
|
97
|
+
style.setProperty('--super-light-color', superLight);
|
|
98
|
+
style.setProperty('--super-dark-color', superDark);
|
|
99
|
+
style.setProperty('--light-color', light);
|
|
100
|
+
style.setProperty('--dark-color', dark);
|
|
101
|
+
};
|
|
102
|
+
const outerDoc = (() => {
|
|
103
|
+
const f = document.querySelector('iframe[name="ace_outer"]');
|
|
104
|
+
return f && f.contentDocument;
|
|
105
|
+
})();
|
|
106
|
+
if (outerDoc) {
|
|
107
|
+
setIframeBase(outerDoc.documentElement.style);
|
|
108
|
+
if (outerDoc.body) setIframeBase(outerDoc.body.style);
|
|
109
|
+
const innerFrame = outerDoc.querySelector('iframe');
|
|
110
|
+
const innerDoc = innerFrame && innerFrame.contentDocument;
|
|
111
|
+
if (innerDoc) {
|
|
112
|
+
setIframeBase(innerDoc.documentElement.style);
|
|
113
|
+
if (innerDoc.body) setIframeBase(innerDoc.body.style);
|
|
114
|
+
}
|
|
115
|
+
}
|
|
39
116
|
},
|
|
40
117
|
init: () => {
|
|
41
|
-
const padcookie = require('ep_etherpad-lite/static/js/pad_cookie').padcookie;
|
|
42
118
|
let theme = themes.getUrlVars().theme;
|
|
43
119
|
|
|
44
120
|
if (!theme) {
|
|
45
121
|
/* Set theme from cookie if it exists */
|
|
46
|
-
|
|
47
|
-
|
|
122
|
+
const stored = padPrefs.getPref('themeName');
|
|
123
|
+
if (stored) {
|
|
124
|
+
theme = stored;
|
|
48
125
|
}
|
|
49
126
|
/* Set default theme if it exists */
|
|
50
|
-
if (!theme && clientVars.theme_default) {
|
|
51
|
-
theme = clientVars.theme_default;
|
|
127
|
+
if (!theme && window.clientVars && window.clientVars.theme_default) {
|
|
128
|
+
theme = window.clientVars.theme_default;
|
|
52
129
|
}
|
|
53
130
|
}
|
|
54
131
|
|
|
@@ -57,16 +134,53 @@ const themes = {
|
|
|
57
134
|
themes.setThemeByName(theme);
|
|
58
135
|
}
|
|
59
136
|
},
|
|
137
|
+
// The colibris skin's `.light-background` and `.dark-background` rules
|
|
138
|
+
// resolve --bg-color / --text-color etc. differently. Etherpad core
|
|
139
|
+
// auto-flips the html classes between these on the pad page when the OS
|
|
140
|
+
// prefers dark mode (see pad.ts:497), but it doesn't do the same for the
|
|
141
|
+
// timeslider — and any theme the user picks via this plugin is "dark"
|
|
142
|
+
// unless it's `normal` or `toothwhite`. To make both pages render the
|
|
143
|
+
// same look, the plugin syncs the html skin-variant classes to the theme.
|
|
144
|
+
syncSkinClasses: (theme) => {
|
|
145
|
+
const lightThemes = new Set(['normal', 'toothwhite']);
|
|
146
|
+
const isLight = lightThemes.has(theme);
|
|
147
|
+
// Only flip the `-background` class. Touching `-toolbar` / `-editor` too
|
|
148
|
+
// makes the colibris toolbar rules resolve --bg-color to the theme's
|
|
149
|
+
// accent colour, which on themes like Terminal makes the toolbar
|
|
150
|
+
// background and the toolbar buttons the same green, so the user can't
|
|
151
|
+
// see their controls. Leaving the toolbar/editor classes alone keeps
|
|
152
|
+
// the toolbar in its default neutral look while the editor area below
|
|
153
|
+
// still picks up the theme.
|
|
154
|
+
const flip = (root) => {
|
|
155
|
+
const cl = root.classList;
|
|
156
|
+
cl.remove(isLight ? 'dark-background' : 'light-background');
|
|
157
|
+
cl.add(isLight ? 'light-background' : 'dark-background');
|
|
158
|
+
};
|
|
159
|
+
flip(document.documentElement);
|
|
160
|
+
const outerDoc = (() => {
|
|
161
|
+
const f = document.querySelector('iframe[name="ace_outer"]');
|
|
162
|
+
return f && f.contentDocument;
|
|
163
|
+
})();
|
|
164
|
+
if (outerDoc) {
|
|
165
|
+
flip(outerDoc.documentElement);
|
|
166
|
+
const innerFrame = outerDoc.querySelector('iframe');
|
|
167
|
+
const innerDoc = innerFrame && innerFrame.contentDocument;
|
|
168
|
+
if (innerDoc) flip(innerDoc.documentElement);
|
|
169
|
+
}
|
|
170
|
+
},
|
|
60
171
|
setThemeByName: (theme) => {
|
|
172
|
+
themes.syncSkinClasses(theme);
|
|
61
173
|
if (theme === 'normal') {
|
|
174
|
+
const n = captureNormal();
|
|
175
|
+
if (!n) return;
|
|
62
176
|
themes.setTheme(
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
177
|
+
n.lightcolor,
|
|
178
|
+
n.superdarkcolor,
|
|
179
|
+
n.darkcolor,
|
|
180
|
+
n.primarycolor,
|
|
181
|
+
n.middlecolor,
|
|
182
|
+
n.textcolor,
|
|
183
|
+
n.superlightcolor
|
|
70
184
|
);
|
|
71
185
|
}
|
|
72
186
|
if (theme === 'highcontrast') {
|
|
@@ -111,3 +225,37 @@ const themes = {
|
|
|
111
225
|
return vars;
|
|
112
226
|
},
|
|
113
227
|
};
|
|
228
|
+
|
|
229
|
+
// In Etherpad 2.x the client_hooks dispatch path is broken (it uses a
|
|
230
|
+
// dynamic require which the bundled output doesn't support), so the
|
|
231
|
+
// aceInitialized / postTimesliderInit hooks in init.js never fire. We
|
|
232
|
+
// instead self-init from this script: wait until the DOM is ready, then
|
|
233
|
+
// for the regular pad, also wait until the editor iframes are mounted so
|
|
234
|
+
// setTheme has somewhere to apply the inner colour vars.
|
|
235
|
+
const themesAutoInit = () => {
|
|
236
|
+
// Timeslider page has no ace_outer iframe — just init immediately.
|
|
237
|
+
if (!document.querySelector('iframe[name="ace_outer"]')) {
|
|
238
|
+
themes.init();
|
|
239
|
+
return;
|
|
240
|
+
}
|
|
241
|
+
// Pad page — wait for the inner editor iframe to be loaded so the
|
|
242
|
+
// outer/inner CSS-var assignments in setTheme actually land.
|
|
243
|
+
let attempts = 0;
|
|
244
|
+
const tick = () => {
|
|
245
|
+
const outer = document.querySelector('iframe[name="ace_outer"]');
|
|
246
|
+
const inner = outer && outer.contentDocument &&
|
|
247
|
+
outer.contentDocument.querySelector('iframe');
|
|
248
|
+
const innerBody = inner && inner.contentDocument && inner.contentDocument.body;
|
|
249
|
+
if (innerBody || attempts++ > 100) {
|
|
250
|
+
themes.init();
|
|
251
|
+
return;
|
|
252
|
+
}
|
|
253
|
+
setTimeout(tick, 100);
|
|
254
|
+
};
|
|
255
|
+
tick();
|
|
256
|
+
};
|
|
257
|
+
if (document.readyState === 'loading') {
|
|
258
|
+
document.addEventListener('DOMContentLoaded', themesAutoInit);
|
|
259
|
+
} else {
|
|
260
|
+
themesAutoInit();
|
|
261
|
+
}
|
package/templates/themesMenu.ejs
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
<label for="themesmenu">Theme:</label>
|
|
4
4
|
</td>
|
|
5
5
|
<td>
|
|
6
|
-
<select id="themesmenu" onchange="
|
|
6
|
+
<select id="themesmenu" onchange="themes.change();">
|
|
7
7
|
<option value="normal">Normal</option>
|
|
8
8
|
<option value="unicorn">Unicorn</option>
|
|
9
9
|
<option value="highcontrast">High Contrast</option>
|