Commit Graph

1891 Commits

Author SHA1 Message Date
Richard Hansen 4a1f21ce34 pad_editbar: Convert snake case to camel case 2021-08-14 07:26:31 -04:00
Richard Hansen 5478d2ce60 pad_editbar: Use ES6 class syntax for readability 2021-08-14 07:26:31 -04:00
Richard Hansen 97ccf9e082 pad_editbar: Factor out duplicate code 2021-08-14 07:08:57 -04:00
Richard Hansen ee41de4809 pad_editbar: Deprecate the `toggleDropDown` callback 2021-08-14 07:08:57 -04:00
Richard Hansen c629ee09a8 pad_editbar: Call the callback asynchronously
This follows JavaScript best practices.
2021-08-14 07:08:57 -04:00
Richard Hansen 148e10821b pad_editbar: Always call the callback 2021-08-14 07:08:57 -04:00
Richard Hansen 07e05a92eb pad_editbar: Call the callback after all work is done 2021-08-14 07:08:57 -04:00
Richard Hansen a1b924f746 pad_editbar: Don't pass a callback to `toggleDropDown()`
The function is synchronous so there's no point.
2021-08-14 07:08:57 -04:00
Richard Hansen 59d6a8b321 pad_editbar: Delete unnecessary `returned` variable 2021-08-14 07:01:50 -04:00
Richard Hansen a4652d67a0 pad_editbar: Move `commands` up for readability 2021-08-14 07:01:50 -04:00
Richard Hansen fda34407f9 pad_editbar: Move `dropdowns` initialization to constructor
This avoids null dereference if a buggy caller calls
`toggleDropDown('none')` before `init()`. (Ideally the caller would be
fixed, but this is not always feasible.)
2021-08-14 07:01:34 -04:00
Richard Hansen 42b0b1bf00 pad_editbar: Move `syncAnimation` out of `padeditbar` IIFE
This avoids the need for an IIFE.
2021-08-14 07:01:13 -04:00
Richard Hansen ee996f530f pad_editbar: Remove unnecessary `syncAnimationFn` variable 2021-08-14 07:01:13 -04:00
Richard Hansen 4b4eef5f4a pad_editbar: Convert `registerDefaultCommands()` into a method 2021-08-14 07:01:13 -04:00
Richard Hansen 0d4f147349 pad_editbar: Simplify iteration 2021-08-14 07:01:13 -04:00
Richard Hansen 11faf6104a pad_editbar: Convert `bodyKeyEvent()` into a method 2021-08-14 07:01:13 -04:00
Richard Hansen b2fe6e3e7e pad_editbar: Fix invalid use of `this` 2021-08-14 07:01:12 -04:00
Richard Hansen b884628a5a pad_editbar: Use arrow functions for callbacks, IIFEs 2021-08-14 07:01:12 -04:00
Richard Hansen bdaa66c346 pad_editbar: Use `this` instead of `self` 2021-08-14 07:01:12 -04:00
Richard Hansen c816c20bc7 HTML import: Replace cheerio with jsdom to simplify contentcollector
Cheerio provides jQuery-like objects but they wrap DOM Node-like
objects that are not 100% API compatible with the DOM spec. Because of
this, contentcollector, which is used in browsers and in Node.js
during HTML import, has until now needed to support two different
APIs. This commit modifies HTML import to use jsdom instead of cheerio
and simplifies contentcollector.
2021-08-12 13:53:23 -04:00
Volker Bijewitz 84d6d277d7 Accessibility fix for JAWS screen readers
ace.js: removed the role 'application' from innerDocument.body. JAWS
do not read any text from the edit lines if this role is set.

domline.createDomLine: to give JAWS the ability to read the lines
correctly, it is required to set the attribute 'aria-live' to
'assertive'.
2021-08-12 13:48:08 -04:00
webzwo0i e61888dfe2 ace.js: Don't use srcdoc when creating iframes (see #4975)
Using srcdoc, especially with multiple nested iframes, seems to be
problematic when using `self` in CSP policies.
2021-07-30 03:51:57 -04:00
Richard Hansen 9fda5adcef ace2_inner.js: Improve discovery of `sidediv` and `linemetricsdiv`
The `Node.nextSibling` property returns the next Node, not the next
Element. If whitespace, an HTML comment, or any other type of
non-Element Node is ever introduced between the Elements then
`.nextSibling` no longer returns the desired Element. Switching to
`Element.nextElementSibling` would work, but finding the Elements by
ID is more readable and future-proof.
2021-07-30 03:51:56 -04:00
Richard Hansen 0c963a817a ace2_inner.js: Delete unnecessary `ace_outerWin` variable 2021-07-30 03:51:56 -04:00
Richard Hansen 8d869ec927 Pad: Delete non-functional debug logging facility 2021-07-30 03:50:23 -04:00
Richard Hansen 5d39a57507 Pad: Delete dead `ace_getFormattedCode()` 2021-07-30 03:49:35 -04:00
Richard Hansen 4ceb3ca4c8 Chat: Allow Shift-Enter to insert a newline 2021-07-19 23:44:33 +02:00
Richard Hansen cf86ae8b63 Chat: Use `KeyboardEvent.key` instead of deprecated `.which` 2021-07-19 23:44:33 +02:00
Richard Hansen faf84f0143 Chat: Display whitespace in chat messages 2021-07-19 23:44:33 +02:00
Richard Hansen 834e05fc9c Chat: Use a `<textarea>` for message input 2021-07-19 23:44:33 +02:00
Xavier Mehrenberger ca4cc2d7c0 Fix settings.useMonospaceFontGlobal
When settings.useMonospaceFontGlobal is set to `true`, it sets the default
font to 'monospace'. This font seems to have been removed in
a5164dad43.

This commit sets the default font to "RobotoMono" which is a valid
option.

Tested in a Docker environment, setting `PAD_OPTIONS_USE_MONOSPACE_FONT`
to `true`

Signed-off-by: Xavier Mehrenberger <xavier.mehrenberger@gmail.com>
2021-07-14 04:33:38 -04:00
Richard Hansen 336d48add7 Add support for square brackets in URLs
This reverts commit 9022877cc6.
2021-07-10 22:22:31 -04:00
Richard Hansen 5f39a1ee7f CSS: Underline links in error dialogs
Underlining was removed for unknown reasons by commit
d872b42e31.
2021-07-09 18:43:13 -04:00
Richard Hansen 3d40ab7e8c CSS: Move author color padding to `setAuthorStyle()`
This prevents the padding from clashing with plugins that use the
`aceSetAuthorStyle` hook.
2021-06-22 14:43:22 -04:00
Richard Hansen 9fcd86b3cd Pad: Fix `<script>` elements in `aceInitInnerdocbodyHead` hook
Using `.innerHTML` to create a `<script>` element does create a DOM
node, but the script is not actually executed. Fortunately, creating a
DocumentFragment does cause the script to execute.
2021-06-18 17:50:15 -04:00
Richard Hansen 251cc7ab32 CSS: Fix button icon centering 2021-06-16 18:27:52 -04:00
Richard Hansen cccabf45b8 pad: Move error message to the top of the gritter box 2021-06-06 21:31:49 -04:00
Richard Hansen b2e94685fb pad: Display error name in the gritter box 2021-06-06 21:31:40 -04:00
webzwo0i 3c087af038 caretPosition: fix loading when iframe is hidden 2021-05-04 23:56:13 +02:00
Richard Hansen c00031a8d8 skiplist: Use `Map.size` to get number of nodes 2021-05-03 01:42:03 -04:00
Richard Hansen 1cdfe9193b skiplist: Convert `_keyToNodeMap` to a `Map` object 2021-05-03 01:42:03 -04:00
Richard Hansen e2eb7327c2 skiplist: Sanity check inserted entries 2021-05-03 01:42:03 -04:00
Richard Hansen 9e2ef6ad5b skiplist: Move `propagateWidthChange()` to `Node` class 2021-05-03 01:42:03 -04:00
Richard Hansen fc103e7f2a skiplist: Define a new `Node` class 2021-05-03 01:42:03 -04:00
Richard Hansen 9fc88f3601 skiplist: Convert point operations into `Point` methods 2021-05-03 01:42:03 -04:00
Richard Hansen 3c1be95e07 skiplist: Move point creation to a new `Point` class 2021-05-03 01:42:03 -04:00
Richard Hansen 8ae40e80f9 skiplist: Save entry in `_insertKeyAtPoint()` 2021-05-03 01:42:03 -04:00
Richard Hansen 0e424fa8c3 skiplist: Remove unnecessary `newKey` arg from `_insertKeyAtPoint()` 2021-05-03 01:42:03 -04:00
Richard Hansen ab8c354f18 skiplist: Use ES6 class syntax
This makess it easier to examine state in dev console.
2021-05-03 01:42:03 -04:00
Richard Hansen 303fd297bd editor: Improve documentation comments 2021-05-03 01:42:03 -04:00
Richard Hansen cbbcef8e90 AttributeManager: Add sanity checks 2021-05-03 01:42:03 -04:00
Richard Hansen d40d59d9eb AttributeManager: Simplify logic 2021-05-03 01:42:03 -04:00
Richard Hansen e3d32a26b6 skiplist: Delete unused methods 2021-05-03 01:42:03 -04:00
Richard Hansen f650c3d73e editor: Delete unused `PROFILER` code 2021-05-03 01:42:03 -04:00
Richard Hansen ab4e99f67a editor: Delete commented-out code 2021-05-03 01:42:03 -04:00
Richard Hansen d01b593d3c chat: Ensure that `ctx.text` is interpreted as HTML 2021-04-11 06:20:29 +02:00
Richard Hansen a3a0ff7bc1 chat: Use jQuery to build the chat message DOM object
This reduces the likelihood of accidentally introducing an XSS
vulnerability.
2021-04-11 06:20:29 +02:00
Richard Hansen 74554d36a5 chat: Allow `chatNewMessage` hook to modify more values 2021-04-11 06:20:29 +02:00
Richard Hansen 91e99c84ca import: Reduce log spam from unsupported elements 2021-04-09 18:43:02 +02:00
Richard Hansen 09c349e2a1 import: Use a Set for supported elements 2021-04-09 18:43:02 +02:00
webzwo0i a796811558 escape userId before setting it as HTML attribute 2021-04-07 23:29:27 -04:00
Richard Hansen 7cbb3f565d tests: Speed up `helper.edit()` and `helper.clearPad()` 2021-04-02 15:46:27 +02:00
Richard Hansen 2776946627 tests: Use cookie libraries to manipulate cookies 2021-04-01 14:31:56 +02:00
Richard Hansen 202d65d2bb pad_cookie: Re-read prefs cookie on every call to `getPref()`
This makes it easier to write tests that clear the prefs cookie.
2021-04-01 14:31:56 +02:00
Richard Hansen 0df41a9a78 pad_cookie: Move initial cookie read+save to `init()`
Benefits of this change:
  * It avoids race conditions with tests that clear cookies.
  * Any attempt to get or set a value before `init()` is called will
    throw an error, ensuring the API is used properly.
  * Improved readability: It's easier to understand what the
    `pad.noCookie` check is doing.
2021-04-01 14:31:56 +02:00
Richard Hansen 1fdaf95c3b collab_client: Delete unused `NO_COMMIT_PENDING` handling 2021-03-30 16:42:53 -04:00
Richard Hansen 63a1f078f4 collab_client: Redo server message queueing
Move server message queue processing out of `handleUserChanges()` for
the following reasons:
  * Fix a race condition: Before this change the client would stop
    processing incoming messages and stop sending changes to the
    server if a `NEW_CHANGES` message arrived while the user was
    composing a character and waiting for an `ACCEPT_COMMIT` message.
  * Improve readability: The `handleUserChanges()` function is for
    handling changes from the local user, not for handling changes
    from other users.
  * Simplify the code.
2021-03-30 16:42:53 -04:00
Richard Hansen e99fe88537 collab_client: Use `Date.now()` instead of casting a Date object
Also rename the `t` variable to `now` to improve readability.
2021-03-30 16:42:53 -04:00
Richard Hansen 5c445eac21 collab_client: Convert `state` var to `committing` bool 2021-03-30 16:42:53 -04:00
Richard Hansen 3ee6b5eb2b collab_client: Delete unused `caughtErrors` 2021-03-30 16:42:53 -04:00
Richard Hansen 81b9a2544d collab_client: Factor out duplicate `ACCEPT_COMMIT` code 2021-03-30 16:42:53 -04:00
Richard Hansen b9753dcc71 Changeset: Return a new op object by default when iterating
Reusing the same op object for each iteration can result in very weird
behaviors because previously yielded op objects will get a surprise
mutation.

It is unclear why the code was written to reuse the same object. There
was no comment, nor is there a commit message providing rationale (it
has behaved this way since the very first commit). Perhaps the objects
were reused to improve performance (fewer object allocations that need
to be garbage collected). I do expect this change to reduce
performance somewhat, but not enough to warrant reverting this commit.
2021-03-29 18:42:55 -04:00
John McLear 2b98b930d7
scaling: include padId in socketio query string 2021-03-24 16:07:11 +00:00
webzwo0i c208d50c4a add version string to iframe_editor.css 2021-03-20 16:42:08 +00:00
Richard Hansen 3ad1d0a74f cssmanager: Refactor CSS manager creation to avoid race condition
Safari takes a while to initialize `document.styleSheets`, which
results in a race condition when loading the pad. Avoid the race
condition by accessing the CSSStyleSheet objects directly from the
HTMLStyleElement DOM objects.
2021-03-20 01:07:16 +00:00
Richard Hansen e2bfe2fd10 pad_editor: Promisify `init()` 2021-03-20 01:07:16 +00:00
Richard Hansen 81e36cf3c7 Ace2Inner: Promisify `init()` 2021-03-20 01:07:16 +00:00
Richard Hansen 742a7cd430 cssmanager: Throw if no matching style sheet is found
This avoids a later null dereference when the stack trace isn't as
useful.
2021-03-20 01:07:16 +00:00
Richard Hansen 5b05ee79ff cssmanager: Simplify iteration over style sheets 2021-03-20 01:07:16 +00:00
Richard Hansen cb9f6d6776 ace: Use iframe `srcdoc` property to refine frame load logic
This seems to fix "null is not an object (evaluating
'browserSheet.insertRule')" errors on Safari.
2021-03-19 17:06:58 +01:00
webzwo0i 6f591b5c77
add class pad to timeslider to fix height issue (#4941) 2021-03-12 21:16:22 -05:00
webzwo0i 8e2a21ec84
arrow functions dont have arguments (#4943) 2021-03-12 14:25:14 -05:00
Richard Hansen 926f0fcefb CSS: Increase size of contenteditable area 2021-03-08 14:39:18 +00:00
Richard Hansen 404486069c ace: Build the outer and inner iframes programmatically
This makes the code easier to read and it silences Chrome's
`document.write()` warning:
https://developers.google.com/web/updates/2016/08/removing-document-write

This is a redo of commit a17f9bf3cf,
which was reverted in commit 912f0f195f
due to a CSS bug.
2021-03-05 19:31:59 +00:00
Richard Hansen 60da2373a6 CSS: Add comment to `no-skin/pad.css` to silence warning
Firefox prints "Style sheet could not be loaded" if the file is empty.
2021-03-05 07:45:48 +00:00
Richard Hansen 5546cc5e7b CSS: Delete bogus `<link>` tag
Browsers report an error with this tag. Strangely, this tag has
existed since Etherpad's very first commit.
2021-03-05 07:45:48 +00:00
Richard Hansen 470f40d7db CSS: Use `auto` for iframe body height
This change makes no visual difference right now, but will matter (for
reasons I don't understand) once we change `ace.js` to build the
iframes by constructing elements in JavaScript (vs. writing HTML).
2021-03-05 07:45:48 +00:00
Richard Hansen 48e1d1c23f CSS: Fix class name for outer iframe `<html>` tag
* Add the class "pad" to the `<html>` tag in `pad.html` (the outer
    iframe's parent).
  * Change the CSS selector that refers to the `<html>` tag in
    `pad.html` from `html:not(.inner-editor)` to `html.pad`.
  * Change the class name of the outer iframe's `<html>` tag from
    "inner-editor" to "outer-editor".
  * Update CSS rules to use the new class name.
2021-03-05 07:45:48 +00:00
Richard Hansen 912f0f195f Revert "ace: Build the outer and inner iframes programmatically"
This reverts commit a17f9bf3cf, which
caused a mysterious bug with the line numbers. Revert to avoid
blocking a new release while I figure out the bug.
2021-03-04 02:05:54 +00:00
Richard Hansen 0aad3b74da pluginfw: Improve rendering of hook list
There are two main benefits:
  * HTML is no longer printed in the startup debug logs.
  * `require()` is no longer called on client-side files. This
    eliminates "Failed to load <file> for <plugin>: ReferenceError:
    window is not defined" errors when users visit
    `/admin/plugins/info`.
2021-03-03 11:19:37 +00:00
Richard Hansen 7e698baa80 pluginfw: Improve hook function load error message 2021-03-03 11:19:37 +00:00
John McLear f95b09e0b6
Import: Import don't show warnings for supported elements 2021-03-02 17:14:47 +00:00
Richard Hansen b0862cd030 ace: Delete all `$$INCLUDE_CSS` logic
The intention of the deleted code was to reduce the number of fetches,
but it only saved a single fetch due to implementation flaws. The
right way to reduce the number of fetches is to use a bundling
technology such as webpack, and this change makes it easier to do so.
2021-03-01 14:32:33 +00:00
Richard Hansen 66d3ac3783 ace: Debug logging 2021-03-01 14:32:33 +00:00
Richard Hansen a17f9bf3cf ace: Build the outer and inner iframes programmatically
This makes the code easier to read and it silences Chrome's
`document.write()` warning:
https://developers.google.com/web/updates/2016/08/removing-document-write
2021-03-01 14:32:33 +00:00
Richard Hansen c696732838 ace: Asyncify `Ace2Editor.init()` 2021-03-01 14:32:33 +00:00
Richard Hansen 159fd5bdeb ace: Simplify passing of `editorInfo` 2021-03-01 14:32:33 +00:00
Richard Hansen e57829183d ace: Pass objects to Ace2Inner via function args 2021-03-01 14:32:33 +00:00
Richard Hansen 6fe0154129 ace: Use absolute URLs when building iframes
This isn't strictly necessary right now, but will become
necessary (due to a Safari quirk) when we change to building the
iframes programmatically (vs. the current `document.write()`
approach).
2021-03-01 14:32:33 +00:00
Richard Hansen 9cfc2fb801 ace: Simplify the `aceEditorCSS` hook map function 2021-03-01 14:32:33 +00:00
Richard Hansen 94c221586c ace: Factor out duplicated `$$INCLUDE_CSS` code 2021-03-01 14:32:33 +00:00
Richard Hansen 54df7f3728 ace: Delete unused `clientVars.disableCustomScriptsAndStyles` 2021-03-01 14:32:33 +00:00
Richard Hansen d84447290e ace: Delete unnecessary IIFE 2021-03-01 14:32:33 +00:00
Richard Hansen 3a311d2182 ace: Lint and simplify script strings 2021-03-01 14:32:33 +00:00
Richard Hansen c9b1f17f25 ace: Format script strings for readability 2021-03-01 14:32:33 +00:00
Richard Hansen b3416c4eeb ace: Delete ignored class attribute 2021-03-01 14:32:33 +00:00
Richard Hansen c9c8b27854 ace: Delete unused `Ace2Editor.getFrame()` method 2021-03-01 14:32:33 +00:00
Richard Hansen 3667f2ca0e Ace2Inner: Fix missing spread operator on `args`
This fixes a bug that was introduced in commit
c38c34bef4.
2021-02-28 08:39:47 +00:00
webzwo0i 348d08c79e ensure version string is attached for inner frame resources 2021-02-27 16:28:12 +00:00
webzwo0i 01dd9f5440 speed up page load 2021-02-27 16:28:12 +00:00
John McLear ba2004cb2d nice-select restore to working
I accidently committed a breaking change in 1b8cd0747d/src/static/js/vendors/nice-select.js
2021-02-27 16:23:39 +00:00
webzwo0i 15dba7d886
move underscore to its old place and remove unnecessary packages (#4876) 2021-02-27 00:10:53 -05:00
webzwo0i fa29858a4e avoid manually including require-kernel in ace.js 2021-02-25 16:59:06 +00:00
Richard Hansen f845f21ba5 /static/tests.html: Fix `jquery.js` path
See commit 1b8cd0747d.
2021-02-25 10:14:48 +00:00
Richard Hansen 1908bedabe caretPosition: Clarify comment in `getPosition()` 2021-02-22 11:25:45 +00:00
Richard Hansen 91955609af caretPosition: Delete pointless logic in `getPosition()`
The `line` variable is unconditionally overwritten later, and the
function calls do not have side effects, so it is safe to delete this
logic.
2021-02-22 11:25:45 +00:00
Richard Hansen 1dbdaf93d7 caretPosition: Delete no-op `Range.detach()` call 2021-02-22 11:25:45 +00:00
Richard Hansen 5e731dfbfd caretPosition: Delete unused var in `getPosition()` 2021-02-22 11:25:45 +00:00
Richard Hansen 02fd0048bf caretPosition: Invert condition in `getPosition()` for readability 2021-02-22 11:25:45 +00:00
Richard Hansen d9c2778d17 plugins: Better fix for LGTM security warning 2021-02-22 09:43:20 +00:00
Richard Hansen 6198e92706 tests: Pass `--legacy-peer-deps` flag to work around npm v7 bug
This flag is unknown to npm v6, but npm v6 silently ignores unknown
flags.
2021-02-22 03:36:12 -05:00
John McLear ce83181ac3
Lgtm bugfixes (#4838)
* code tidy up: always evaluates

* tidy up: is always true

* tidy up: remove unused code

* always true/false variables

* unused variable

* tidy up: remove unused code in caretPosition.js

* for squash: Revert "tidy up: remove unused code in caretPosition.js"

The `if` condition was previously always true, so the body should be
preserved. If the body is preserved, other logic can be deleted. I
opened PR #4845 to clean it all up.

This reverts commit 75b03e5a7dc1ff9a8728ed2341fd9fe970d0615f.

* for squash: simplify

* for squash: Explain that the getter is used for its side effects

It's very weird to call a getter without using its return value. Add a
comment explaining why this is done so that the reader doesn't get
confused.

* for squash: Revert "tidy up: remove unused code"

The exception test was the purpose of the code.

This reverts commit 85153b167613b2513fff99e22b8ded8ea1e4547b.

* for squash: Log the tsort results

Co-authored-by: Richard Hansen <rhansen@rhansen.org>
2021-02-22 08:26:35 +00:00
John McLear 6b6201b448
null link on plugins and noopener / noreferrer
Resolves a (non) security issue brought up by LGTM but I think the noopener and norefferer are good shouts
2021-02-21 19:30:39 +00:00
John McLear 1b8cd0747d
Move vendor libraries to /vendors folder and exclude from LGTM 2021-02-21 15:07:39 +00:00
webzwo0i 0bb3e65020 fix for caching plugin-definitions 2021-02-21 14:31:15 +00:00
John McLear 086b59b30d
editor: UI polish - Etherpad brand as reconnect & loading animation 2021-02-21 13:24:51 +00:00
John McLear ee2b32281c
pluginfw: Warn plugins on missing plugin (#4826)
* pluginfw: Warn plugins on missing plugin

Add functionality to console.warn when a plugin is missing.  This will help admins know when people are trying to use plugins that are missing.  Resolves https://github.com/ether/etherpad-lite/issues/4730

* pluginfw: importing .etherpad can notify admins of missing plugins

Extending .etherpad imports to notify admins if a missing plugin is present

* Update ImportEtherpad.js
2021-02-21 11:07:13 +00:00
John McLear 77b2f372ab lint: pad_userlist.js arrow functions
This probably needs a good rewrite/refactor to remove self.
2021-02-21 11:05:25 +00:00
John McLear 2511eed472 lint: Changeset.js more literal conditionals 2021-02-21 11:05:25 +00:00
John McLear 8cbd5222dd lint: pad_userlist.js - remove require browser 2021-02-21 11:05:25 +00:00
John McLear 73b3a2dc54 lint: AttributeManager.js use ES6 method for hasAttrib 2021-02-21 11:05:25 +00:00
John McLear f86578ffc3 lint: changesettracker.js var > const/let and other easy fixes 2021-02-21 11:05:25 +00:00
John McLear 3635cb6ca6 lint: changesettracker.js long-lines 2021-02-21 11:05:25 +00:00
John McLear f5f4e3a6d1 lint: changesettracker.js arrow funcs 2021-02-21 11:05:25 +00:00
John McLear d4b6cbc897 line: broadcast.js 2021-02-21 11:05:25 +00:00
John McLear 3b5b996d84 lint: Changeset no var 2021-02-21 11:05:25 +00:00
John McLear 0b78ad2f90 lint: Changeset.js curly braces in correct position 2021-02-21 11:05:25 +00:00
John McLear 23d7544763 lint: Changeset.js max-len 2021-02-21 11:05:25 +00:00
John McLear 98a0e76a20 lint: Changeset.js opcode eqeqeq checks 2021-02-21 11:05:25 +00:00
John McLear d91f2b5b07 lint: Changeset.js additional arrow functions 2021-02-21 11:05:25 +00:00
John McLear acccf56724 lint: Changeset.js arrow-functions 2021-02-21 11:05:25 +00:00
John McLear cf37f52093 lint: collab_client.js 2021-02-21 11:05:25 +00:00
John McLear b029edb931 lint: index.js 2021-02-21 11:05:25 +00:00
John McLear 01dd004054 lint: ChangesetUtils 2021-02-21 11:05:25 +00:00
John McLear 7c51446040 lint: use strict 2021-02-21 11:05:25 +00:00
John McLear c64b1b8ead lint: skins 2021-02-21 11:05:25 +00:00
Sebastian Castro 4ca2d7ea3a
include lineHeight property in sidebar elements (#4831)
This also makes the full line number element clickable to ensure a positive UX for the ``?lineNumber`` URL endpoint.  It also makes it more obvious that a click action can happen based on the hover.

Make line numbers stick to baseline of first line of wrapped content and editor lines with increased line hieght.

Make it compatible with ep_author_neat
2021-02-20 13:24:17 +00:00
Richard Hansen b3b5af3c3c plugins: Use `npm` CLI to install/uninstall plugins
Using npm as a module has long been discouraged and will stop working
with npm v7.
2021-02-18 19:18:59 +00:00
Richard Hansen 1cfbf88f7c run_cmd: Enhance with ability to return stdout as string 2021-02-18 19:18:59 +00:00
Richard Hansen d8bb5aa009 plugins: Eliminate unnecessary `run_npm.js`
I had anticipated more shared logic than we actually need (the
abstraction in `run_npm.js` is YAGNI).
2021-02-18 19:18:59 +00:00
Richard Hansen 689a75b381 plugins: Pass `--no-production` instead of setting `NODE_ENV=development` 2021-02-18 19:18:59 +00:00
Richard Hansen dcf7891316 plugins: Improve logging of plugin events
This will make it easier to troubleshoot plugin and npm issues.
2021-02-18 19:18:59 +00:00
Richard Hansen 4253a2ea8f plugins: Move hook call and plugin update out of try block
Exceptions thrown by these function calls are serious and should crash
Etherpad.
2021-02-18 19:18:59 +00:00
Richard Hansen a8479e4a0e lint: Fix some ESLint errors in pluginfw 2021-02-18 19:18:59 +00:00
Richard Hansen f868788417 Remove unnecessary `path.normalize()` calls
`path.join()` already normalizes.
2021-02-18 19:18:59 +00:00
Richard Hansen 30dbdf29f4 import: Convert arrow function to regular function
This fixes a bug introduced in commit
b711ff6acf. Some time between when that
commit was originally written and when it was merged a round of
linting had converted the function from a regular function to an arrow
function because `this` was never in the body of the function. When I
rebased the commit, which introduced `this` to the body, I didn't
catch the error.
2021-02-18 03:42:56 -05:00
Richard Hansen c39d0606cf ace2_inner: Delete special arrow key handling
I can't see any reason this would be necessary, and it appears to not
behave as intended (`scroll.scrollWhenPressArrowKeys()` is not invoked
after a continuously held arrow key is finally let up).
2021-02-16 11:03:31 +00:00
Guilherme Goncalves 3ff244f7a0 Update lines with zero height on sidediv
Avoid evaluation of `0` height as false within `if` condition,
since it is possible having 0px as line-height.
2021-02-15 00:42:00 -05:00
Richard Hansen b711ff6acf import: Ajaxify pad import
This eliminates an inline script (good for Content Security Policy)
and improves the user experience.
2021-02-14 08:35:38 +00:00
Richard Hansen 26b5a69ccc ImportHandler: Use `JSON.stringify()` to properly escape characters 2021-02-14 08:35:38 +00:00
Richard Hansen cc52811cd0 pad_impexp: Use jQuery to build the import failure popup
This reduces the chances of accidentally introducing an XSS
vulnerability.
2021-02-14 08:35:38 +00:00
Richard Hansen d869d96a2b pad_impexp: Simplify creation of import failure message 2021-02-14 08:35:38 +00:00
Richard Hansen 890e16f6fc pad_impexp: Style fixes to improve readability 2021-02-14 08:35:38 +00:00
Richard Hansen efe07cd027 pad_impexp: Invert logic to improve readability 2021-02-14 08:35:38 +00:00
Richard Hansen ce4ce8ce95 pad_impexp: Delete unnecessary `importFailed` wrapper 2021-02-14 08:35:38 +00:00
Richard Hansen 8a221ca773 pad: Delete dead code 2021-02-14 08:35:38 +00:00
Richard Hansen 8f2f6593be lint: Re-run `eslint --fix` 2021-02-13 00:31:36 -05:00
Richard Hansen 8ae8710a14 ace: Fix EMBEDDED check 2021-02-12 07:08:51 +00:00
John McLear cc7f11560f
Fix OL list items not increasing (#4749)
* tests: additional test coverage for OL items

* parseInt means we can do a proper check

* tests: use ol check value test for #4748
2021-02-11 13:26:37 -05:00
Richard Hansen 2301c6ec83 pad: Don't throw on socket.io error 2021-02-11 17:25:09 +00:00
Richard Hansen fc9f236977 plugins: Use `npm ls` to list the installed plugins
This speeds up startup considerably, and we get rid of a lot of buggy
code.

This works with both npm v6.x and v7.x.
2021-02-09 22:18:35 +00:00
John McLear 9070c71e9f color picker: allow full white 2021-02-08 11:01:27 +00:00
Richard Hansen 1c9afa5168 lint: src/static/js/ace.js 2021-02-07 20:04:07 +00:00
Richard Hansen 8668017c62 ace: Use `globalThis` instead of non-strict default context
This is necessary before `'use strict';` can be added to the top of
the file.
2021-02-07 20:04:07 +00:00
Richard Hansen 3c2e0f0e16 ace: Simplify Ace2Editor method creation
* Delete the unused `optDoNow` parameter from `pendingInit()`.
  * Move the `setAuthorInfo()` 1st parameter check out of the wrapper
    and in to the `setAuthorInfo()` function itself.
2021-02-07 20:04:07 +00:00
John McLear 4862d6fa9c
editor: fix enter key keep line in view (#4639) 2021-02-06 19:56:59 +00:00
John McLear 5f58ce14d6
editor: remove grayed logic and styles so background color is not lost on disconnect/reconnect. 2021-02-06 09:58:10 +00:00
Richard Hansen 8b28e00784 restructure: Prefix `bin/` and `tests/` with `src/`
This is a follow-up to commit
2ea8ea1275.
2021-02-05 21:52:08 +00:00
Richard Hansen 5a865dfc7e pluginfw: Delete unused return value 2021-02-04 08:41:00 +00:00
Richard Hansen a145b97682 pluginfw: Use `for` loops to improve readability 2021-02-04 08:41:00 +00:00
Richard Hansen fdaacc44c8 pluginfw: Replace `slide.asyncMap()` with `Promise.all()` 2021-02-04 08:41:00 +00:00
Richard Hansen 746cc8cc34 pluginfw: In-line `formatPluginsWithVersion()`
There's only one caller of the function, so move the logic to where it
is used.
2021-02-04 08:41:00 +00:00
Richard Hansen c5f0274116 lint: Move functions up to fix more lint errors 2021-02-04 08:41:00 +00:00
Richard Hansen 99ca57f3ab lint: src/static/js/pluginfw/shared.js 2021-02-04 08:41:00 +00:00
Richard Hansen 2c80c1f2da lint: src/static/js/pluginfw/read-installed.js 2021-02-04 08:41:00 +00:00
Richard Hansen 2b32bc1840 lint: src/static/js/pluginfw/plugins.js 2021-02-04 08:41:00 +00:00
Richard Hansen 9a86ebec2a pluginfw: Fix state reset logic 2021-02-04 08:41:00 +00:00
Richard Hansen 895764e047 pluginfw: Return from `findUnmet()` early if not given an object
For some reason strings are sometimes passed to `findUnmet()`, which
is obviously unexpected given the way the code is written. Rather than
figure out why strings are passed and how to safely avoid passing
strings, just return early. The net effect is the same, but returning
early avoids setting a property on a string, which is prohibited in
strict mode.
2021-02-04 08:41:00 +00:00
Richard Hansen a06662fd00 pluginfw: Delete commented-out code 2021-02-04 08:41:00 +00:00
Richard Hansen c64ee6ff4c pluginfw: Call `npm.load()` before using `npm`
This code is only used when testing `read-installed.js` by running it
directly (e.g., `node src/static/js/pluginfw/read-installed.js`).
2021-02-04 08:41:00 +00:00
freddii ea202e41f6 docs: fixed typos 2021-02-03 00:30:07 +01:00
Richard Hansen 05e0e8dbf7 hooks: New `callAllSerial()` function
This is necessary to migrate away from `callAll()` (which only
supports synchronous hook functions).
2021-02-02 09:09:02 +00:00
Richard Hansen 763fe6fc26 hooks: Document `callFirst()` and `aCallFirst()` 2021-02-02 09:09:02 +00:00
Richard Hansen 6f30ea7c38 hooks: Use `callHookFn{Sync,Async}()` for `{call,aCall}First()`
Benefits of `callHookFnSync()` and `callHookFnAsync()`:
  * They are a lot more forgiving than `hookCallWrapper()` was.
  * They perform useful sanity checks.
  * They have extensive unit test coverage.
  * They make the behavior of `callFirst()` and `aCallFirst()` match
    the behavior of `callAll()` and `aCallAll()`.
2021-02-02 09:09:02 +00:00
Richard Hansen c11d60c5f6 hooks: Check context nullness, not truthiness 2021-02-02 09:09:02 +00:00
Richard Hansen fd5d3ce777 hooks: Inline `aCallFirst()` into `exports.aCallFirst()` 2021-02-02 09:09:02 +00:00
Richard Hansen 77f480d954 hooks: Asyncify `aCallFirst` 2021-02-02 09:09:02 +00:00
Richard Hansen 22d02dbcbf hooks: Factor out value normalization 2021-02-02 09:09:02 +00:00
Richard Hansen f316a3bacd hooks: Never pass a falsy error to a callback 2021-02-02 09:09:02 +00:00
Richard Hansen 708206449a hooks: Factor out callback attachment
The separate function will be reused in a future commit.
2021-02-02 09:09:02 +00:00