Commit graph

1924 commits

Author SHA1 Message Date
Richard Hansen
18a6b7279c Changeset: Only pass strings to parseNum() 2021-11-13 17:44:38 -05:00
Richard Hansen
7ec0d5f385 Changeset: Remove unnecessary linesApplySplice() 2021-11-13 17:44:38 -05:00
Richard Hansen
37bb297e76 Changeset: Improve logged error message
I saw this on a production system today and wanted more information.
2021-11-13 17:44:38 -05:00
Richard Hansen
7fa9b07116 Changeset: Invert conditions to improve readability 2021-11-13 17:44:38 -05:00
Richard Hansen
b29e59419e Changeset: Factor out duplicate code 2021-11-13 17:44:38 -05:00
Richard Hansen
4a65c2c8ff Changeset: Unexport unnecessarily exported functions
These functions aren't used outside of this file.
2021-11-13 17:44:38 -05:00
Richard Hansen
085bc8cbb3 plugins: Don't create .ep_initialized files
These files cause problems with Docker images and read-only
directories/mounts, and they have dubious value (any install-time
setup should instead be done at startup).
2021-11-13 17:43:33 -05:00
Richard Hansen
0f7c5a8782 lint: Use window. to avoid global declaration 2021-11-12 23:45:05 -05:00
webzwo0i
8b73b911c9 Changeset: Use string templates
Co-authored-by: Richard Hansen <rhansen@rhansen.org>
2021-11-09 01:05:53 +01:00
Richard Hansen
cc688f7367 ace: Delete dead code 2021-11-07 23:24:39 -05:00
Richard Hansen
5283bfc14a linestylefilter: Delete unused arguments 2021-11-07 23:24:39 -05:00
Richard Hansen
dd8ec4e291 Changeset: Remove unused lastIndex() method from op iterator 2021-11-07 23:24:39 -05:00
Richard Hansen
0fd2a46783 Changeset: Remove unused start index parameter for opIterator() 2021-11-07 23:24:39 -05:00
Richard Hansen
43dae4cb1d Changeset: Delete unused index parameters in applyZip() 2021-11-07 23:24:24 -05:00
Richard Hansen
b3215992c9 changesettracker: Delete IE8 compatibility code 2021-11-07 22:42:31 -05:00
Richard Hansen
ad6de52eb2 Changeset: More JSDoc comment improvements 2021-11-07 22:42:31 -05:00
Richard Hansen
56cb08f4c5 pad: Pass color and display name in CLIENT_READY 2021-11-05 18:14:27 -04:00
Richard Hansen
7a0d8cb52e pad: Use URLSearchParams to process search params
Also unexport `getUrlVars` because it isn't used outside the file.
2021-11-05 18:14:27 -04:00
Richard Hansen
6bf8142221 chat: Translate newly created message entries 2021-11-01 04:56:46 -04:00
Richard Hansen
99b7bdd176 chat: Set timestamp CSS font-size: smaller; 2021-11-01 01:54:29 -04:00
Richard Hansen
51907015ed chat: Fix gritter duration 2021-11-01 01:54:29 -04:00
Richard Hansen
23f963c9fe chat: Improve name mention detection 2021-11-01 01:54:29 -04:00
Richard Hansen
9fbd2e5c3d chat: New chatSendMessage client-side hook 2021-11-01 01:54:28 -04:00
Richard Hansen
4c2f7f9a11 chat: Rename userId to authorId, userName to displayName 2021-11-01 01:54:28 -04:00
Richard Hansen
0f47ca9046 chat: Plumb message object end to end
This will make it possible for future commits to add hooks that allow
plugins to augment chat messages with arbitrary metadata.
2021-11-01 01:54:28 -04:00
Richard Hansen
f1f4ed7c58 chat: Allow chatNewMessage hook to control rendering 2021-11-01 01:54:28 -04:00
Richard Hansen
2597b940f4 chat: Give chatNewMessage hook access to the raw message object 2021-11-01 01:54:28 -04:00
Richard Hansen
caac4bf711 chat: Promisify addMessage() 2021-11-01 01:54:28 -04:00
Richard Hansen
3f7f629eeb chat: Scroll down after the chatNewMessage hook finishes 2021-11-01 01:54:28 -04:00
Richard Hansen
195a6bd81b chat: Move click handler setup to init() 2021-11-01 01:54:28 -04:00
Richard Hansen
c8e0916e1a tests: Spy on socket.io messages as early as possible 2021-11-01 01:54:28 -04:00
Richard Hansen
d36a37d666 PadMessageHandler: Delete unnecessary protocolVersion
We can assume that the client code is always in sync with what the
server expects.
2021-10-30 03:06:57 -04:00
Richard Hansen
80e84636d7 pad: Promisify handshake() 2021-10-29 19:38:28 -04:00
Richard Hansen
cd4f5ff281 pad: Defer message handling until handshake completes 2021-10-29 19:37:28 -04:00
Richard Hansen
be0298290d pad: Move post-handshake code to _afterHandshake() 2021-10-29 19:27:33 -04:00
Richard Hansen
9fb754ce3a pad: Initialize pad cookie before starting the handshake 2021-10-29 19:27:33 -04:00
Richard Hansen
f6c5ce606e pad: Move UI setup from handshake() to init() 2021-10-29 19:27:33 -04:00
Richard Hansen
bd44a87388 pad: Unexport unnecessarily exported handshake() function 2021-10-29 19:27:33 -04:00
Richard Hansen
5cbbcbcee6 pad: Simplify reload after .etherpad import
The old "switch to pad" logic looked buggy, and it complicates pad
initialization. Forcing a refresh after importing an `.etherpad` file
isn't much of a UX downgrade.
2021-10-29 19:27:33 -04:00
Richard Hansen
e974622561 pad: Use window. to avoid ESLint error 2021-10-29 19:27:33 -04:00
webzwo0i
d8ca3a693d timeslider scrollTo: fixes wrong line number calculation in case there
are no attribute changes and no length changes
2021-10-29 02:38:29 -04:00
Richard Hansen
de3dfb5ce2 AttributePool: Add JSDoc comments 2021-10-24 21:18:56 -04:00
Richard Hansen
c98b521539 AttributePool: Use ES6 class syntax 2021-10-24 21:18:56 -04:00
webzwo0i
bbc8b29ffd Changeset: Improve JSDoc comments
Co-authored-by: Richard Hansen <rhansen@rhansen.org>
2021-10-24 21:18:56 -04:00
Richard Hansen
788eb86d84 Ace2Inner: Inline code that is unnecessarily inside an IIFE 2021-10-07 19:53:40 -04:00
Richard Hansen
4890cd8972 Ace2Inner: Delete completed TODO comment 2021-10-07 19:53:40 -04:00
Richard Hansen
044f6543a5 lint: Fix ESLint errors (mostly camelcase warnings) 2021-10-07 19:53:40 -04:00
Richard Hansen
34cfff4e4c Changeset: Delete unused code 2021-10-07 19:53:40 -04:00
Richard Hansen
eb495e9ea2 Changeset: Move out obsolete code 2021-10-07 19:53:40 -04:00
John McLear
c361df52d2 bugfix: Allow selection to start/end before line marker 2021-10-02 02:41:58 -04:00
Richard Hansen
37a33042d2 ace2_inner: Improve rep documentation 2021-10-02 02:10:07 -04:00
webzwo0i
4d8ae3475d Changeset: Add documentation for textLinesMutator() 2021-09-30 12:29:24 +02:00
Richard Hansen
4d2839457a CSS: Fix underscore and clear authorship icon alignment 2021-09-26 12:07:56 +02:00
Richard Hansen
7dbd278d1d deps: Bump js-cookie to 3.0.0 2021-08-29 23:36:48 -04:00
Richard Hansen
0d65dc8a44 pad: Add clientVars to postAceInit hook context
This allows plugins to avoid the `clientVars` global variable.
2021-08-25 14:59:17 -04:00
Richard Hansen
fed950e809 ace2_inner: Simplify handler for Ctrl-@ (show authors) 2021-08-16 00:34:30 -04:00
Richard Hansen
88057eade2 ace2_inner: Readability improvements 2021-08-16 00:34:30 -04:00
Richard Hansen
bc6428025a ace2_inner: Use for..of iteration to improve readability 2021-08-16 00:34:30 -04:00
Richard Hansen
f06307cb4c ace2_inner: Fix for..in iteration
See commit c38c34bef4.
2021-08-16 00:34:30 -04:00
Richard Hansen
2d50a8aa95 ace2_inner: Fix efficiency of rangeForLine()
Returning `true` or `false` has no effect when iterating using
`Array.prototype.forEach`. This fixes a bug introduced in commit
b28bfe8e31.
2021-08-16 00:34:30 -04:00
Richard Hansen
ca2e008e7b ace2_inner: Move variable declarations to appropriate scope 2021-08-16 00:34:30 -04:00
Richard Hansen
bf10e70f2e ace2_inner: Delete unnecessary currentLine variable 2021-08-16 00:34:30 -04:00
Richard Hansen
9fc613d362 ace2_inner: Delete unnecessary checks 2021-08-16 00:34:30 -04:00
Richard Hansen
a5f9c60a34 ace2_inner: Operate on Elements, not Nodes 2021-08-16 00:34:30 -04:00
Richard Hansen
aad75e4661 ace2_inner: Factor out duplicate line number div creation 2021-08-16 00:34:30 -04:00
Richard Hansen
3237f8d123 ace2_inner: Simplify iteration over line number divs 2021-08-16 00:34:30 -04:00
Richard Hansen
b238d9610a ace2_inner: Factor out duplicate line height application 2021-08-16 00:34:30 -04:00
Richard Hansen
1b890e3d4d ace2_inner: Replace lineNumbersShown with number of children 2021-08-16 00:34:30 -04:00
Richard Hansen
27363bf729 ace2_inner: Add line number divs directly, not via fragment
There's no layout thrashing so the fragment doesn't provide any
benefit.
2021-08-16 00:34:30 -04:00
Richard Hansen
e1a024847c ace2_inner: Delete unnecessary innerdocbody variable 2021-08-16 00:34:30 -04:00
Richard Hansen
7d807d2fc5 ace2_inner: Delete unnecessary container variable 2021-08-16 00:34:30 -04:00
Richard Hansen
4b4584c264 ace2_inner: Delete unnecessary doc and root variables 2021-08-16 00:34:25 -04:00
Richard Hansen
ec63c15a40 ace2_inner: Simplify document body selection 2021-08-16 00:31:09 -04:00
Richard Hansen
11c86e677a ace2_inner: Consistently use outerWin and outerDoc 2021-08-16 00:31:09 -04:00
Richard Hansen
98c1ba5808 ace2_inner: Use destructuring assignment to simplify 2021-08-16 00:31:09 -04:00
Richard Hansen
c7be4f9d2d ace2_inner: Move sidedivinner creation to ace.js 2021-08-16 00:31:09 -04:00
Richard Hansen
15b1d4cb75 ace2_inner: Build sidedivinner programmatically 2021-08-16 00:31:09 -04:00
Richard Hansen
b80295c228 ace2_inner: Combine declaration and initialization 2021-08-16 00:31:09 -04:00
Richard Hansen
7a8edc816b ace2_inner: Replace initLineNumbers() with an IIFE 2021-08-16 00:31:09 -04:00
Richard Hansen
b5bfff43cf ace2_inner: Delete redundant class assignment 2021-08-16 00:31:08 -04:00
Richard Hansen
e581ee01f2 ace2_inner: Formatting improvements 2021-08-16 00:30:50 -04:00
Richard Hansen
0ca5a3459f Timeslider: Install an error handler 2021-08-14 07:44:05 -04:00
Richard Hansen
b6fba9d66d Pad: Improve page load error handler
* Install the error handler early.
  * Include stack trace.
  * Remove unnecessary escaping.
  * Improve formatting.
  * Move to a separate script file.
2021-08-14 07:44:05 -04:00
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