diff --git a/.github/workflows/backend-tests.yml b/.github/workflows/backend-tests.yml index b691a8233..e4facbff7 100644 --- a/.github/workflows/backend-tests.yml +++ b/.github/workflows/backend-tests.yml @@ -124,14 +124,13 @@ jobs: ep_author_hover ep_cursortrace ep_font_size - ep_hash_auth ep_headings2 ep_markdown ep_readonly_guest ep_set_title_on_pad ep_spellcheck ep_subscript_and_superscript - ep_table_of_contents --runtimeVersion="${{ matrix.node }}" + ep_table_of_contents - name: Run the backend tests run: gnpm test --runtimeVersion="${{ matrix.node }}" @@ -232,22 +231,19 @@ jobs: run: gnpm build --runtimeVersion="${{ matrix.node }}" - name: Install Etherpad plugins - # The --legacy-peer-deps flag is required to work around a bug in npm - # v7: https://github.com/npm/cli/issues/2199 run: > gnpm install --workspace-root ep_align ep_author_hover ep_cursortrace ep_font_size - ep_hash_auth ep_headings2 ep_markdown ep_readonly_guest ep_set_title_on_pad ep_spellcheck ep_subscript_and_superscript - ep_table_of_contents --runtimeVersion="${{ matrix.node }}" + ep_table_of_contents # Etherpad core dependencies must be installed after installing the # plugin's dependencies, otherwise npm will try to hoist common # dependencies by removing them from src/node_modules and installing them diff --git a/src/node/utils/Settings.ts b/src/node/utils/Settings.ts index 46bc487c8..ee09141a7 100644 --- a/src/node/utils/Settings.ts +++ b/src/node/utils/Settings.ts @@ -658,6 +658,20 @@ const settings: SettingsType = { } export default settings; +// CJS compatibility: plugins use require('ep_etherpad-lite/node/utils/Settings') +// and expect settings properties directly on the module object, not under .default +if (typeof module !== 'undefined' && module.exports) { + const currentExports = module.exports; + for (const key of Object.keys(settings)) { + if (!(key in currentExports)) { + Object.defineProperty(currentExports, key, { + get: () => (settings as any)[key], + enumerable: true, + configurable: true, + }); + } + } +} /** * This setting is passed with dbType to ueberDB to set up the database diff --git a/src/node/utils/toolbar.ts b/src/node/utils/toolbar.ts index 461ede049..f8e70fb30 100644 --- a/src/node/utils/toolbar.ts +++ b/src/node/utils/toolbar.ts @@ -276,6 +276,9 @@ module.exports = { * Valid values for page: 'pad' | 'timeslider' */ menu(buttons: string[][], isReadOnly: boolean, whichMenu: string, page: string) { + if (!buttons || buttons.length === 0 || !buttons[0]) { + return ''; + } if (isReadOnly) { // The best way to detect if it's the left editbar is to check for a bold button if (buttons[0].indexOf('bold') !== -1) {