Commit Graph

195 Commits

Author SHA1 Message Date
Simon Rozman
393c372bbf Merge remote-tracking branch 'remotes/origin/master' 2024-06-24 14:59:58 +02:00
Simon Rozman
d7b6220e57 TODO added 2024-06-24 14:58:58 +02:00
Simon Rozman
8abb1a56d7 Reuse text element computed styles if applicable 2024-06-24 14:53:53 +02:00
Simon Rozman
e0b20b9030 Cleanup 2024-06-24 14:52:50 +02:00
Simon Rozman
bddae0793e Revise host element display detection logic
BesService may be registered on any HTML element: <p>, <body>,
<whatever>... Not only <div>, <textarea> and CKEditor. Therefore, we
need more generic test to distinguish which resize strategy works best.
2024-06-24 14:52:16 +02:00
df4d293ffb Implement position observer to monitor if hostElement moves it's position 2024-06-20 09:47:36 +02:00
7dc00af858 Improve logic for adjusting correction panel dimensions to support inline elements
This is still a WIP commit, hence the code is yet to be refactored eventually
2024-06-20 08:52:16 +02:00
Simon Rozman
9c869a2897 Fix correction panel size calculation 2024-06-18 11:09:03 +02:00
Simon Rozman
e2cb4b95e3 Fix contenteditable attribute evaluation 2024-06-18 10:51:24 +02:00
Simon Rozman
00b416f8cb samples: Reorder HTML to group related things together 2024-06-18 10:44:33 +02:00
Simon Rozman
3a8919c260 Add convenience methods for runtime (un)registration and a sample 2024-06-18 09:49:09 +02:00
Simon Rozman
843d2d5b1f Prevent duplicate service registrations 2024-06-18 09:38:54 +02:00
Simon Rozman
b2fcaab30b samples: Sync text 2024-06-18 08:50:53 +02:00
Simon Rozman
604fc960d5 service2.js → service.js 2024-06-14 12:30:07 +02:00
Simon Rozman
4060f0866c service2.js: Finish <textarea> support 2024-06-14 12:25:33 +02:00
Simon Rozman
e1b4bfb2c0 Move repositionAllMarkup() upstream 2024-06-13 10:05:55 +02:00
Simon Rozman
6b92aeb11a Document constructors 2024-06-12 12:50:15 +02:00
Simon Rozman
2f8b8d0e45 Extend classes documentation
This should encourage developers and users of this service pick the
right tool for the right job.
2024-06-11 11:05:14 +02:00
Simon Rozman
a5bc133d5e Center popup placement on narrow screens
Previous calculation resulted in out of screen placement on insanely
narrow screens.
2024-06-10 16:39:47 +02:00
Simon Rozman
56a27c8432 Revise rule classification
The LanguageTool browser plugin marks spelling mistakes with rule(s)
which ID starts with "MORFOLOGIK_RULE". This adopts the same logic.
2024-06-10 16:38:47 +02:00
Simon Rozman
a23037d23a Merge remote-tracking branch 'remotes/origin/master' 2024-06-10 16:00:54 +02:00
Simon Rozman
71b56bd005 Merge commit '7a72474cd3e84a97478be011c45a43a4afe8ca7d' 2024-06-10 15:50:08 +02:00
Simon Rozman
43d7198b74 Revert "Implement debouncing to optimize text error handling"
It provided partial implementation only: for BesDOMService. What about
CKEditor?

This was optimizing something that users could "potentially" experience.
I didn't experience any performance problems on texts with hundreds of
grammar mistakes. Let alone a typical text users would have.

Skipping repositionAllMarkup() provides temporary misalignment between
markup and text. Performance vs. aesthetics?

Not convinced.

Reverts: 32f4360de9
2024-06-10 15:46:25 +02:00
Simon Rozman
f1bd0a2416 Merge commit '32f4360de9a5d2654a338ecf590d8f5f5cae2fec' 2024-06-10 15:04:23 +02:00
Simon Rozman
4467fab2a8 Put back horizontal scrolling option again
DOM document is 2-dimensional! What applies to one dimension, may apply
to another too. Never assume we're scrolling texts vertically only.
2024-06-10 15:01:10 +02:00
Simon Rozman
ba9a18705e Merge commit 'e8b1ab94d9ae1a26152f7b4ebaafd7b12480dbb3' 2024-06-10 14:53:46 +02:00
Simon Rozman
f5257f1872 Fix&finish mistake highlight rect management
Proposed solution was not complete, match.highlights is not an array
without a good reason, so checking only match.highlights[0] is never
a good idea. Should a grammar mistake wrap across more lines of text,
match.highlights gets one element per each part of the _same_ grammar
that spans one line of text. By not checking them all, popup failed
to appear when clicking on a grammar mistake following on the next line
of text.

Furthermore, the solution only addressed BesTreeService.onClick(), while
the same logic should be applied to BesPlainTextService.onClick() too.
2024-06-10 14:50:54 +02:00
Simon Rozman
55a075b927 Merge commit '159cd516846b196fd13c640d28d55b0821bbbdb3' 2024-06-10 14:50:27 +02:00
Simon Rozman
efc0009301 Put back horizontal scrolling option
DOM document is 2-dimensional! What applies to one dimension, may apply
to another too. Never assume we're scrolling texts vertically only.
2024-06-10 14:49:06 +02:00
edbe39722f Refactor ruleType logic to make it accessible within other besService subclasses 2024-06-05 10:18:55 +02:00
54ba1dea33 Push ruleType into matches object, since it is needed later to correctly reposition markup 2024-06-05 09:47:57 +02:00
81d60bd37e Add distinct highlighting for various error types 2024-06-05 09:15:28 +02:00
7a72474cd3 Solve an issue where the highlight rectangles were split across separate lines. 2024-06-04 09:37:55 +02:00
32f4360de9 Implement debouncing to optimize text error handling
Previously, texts with numerous errors could cause performance issues due to the high frequency of function calls. With the new debouncing implementation, we effectively limit the rate at which the error handling function executes, thereby reducing potential lagginess and improving the overall user experience.
2024-06-03 10:49:34 +02:00
a23dea067c Enhance visual appearance of popup element 2024-05-30 09:03:54 +02:00
e8b1ab94d9 Improve status div positioning 2024-05-30 07:49:51 +02:00
953d0ef548 Create a mock page for DOM changes 2024-05-24 16:55:25 +02:00
7cf139ddaa Remove a redundant comment 2024-05-24 16:52:58 +02:00
159cd51684 Improve the logic for repositioning grammar mistake highlights in response to DOM changes
Refactor the click detection logic to check if the click was inside the rectangle of the highlight element, rather than relying on stored rectangle coordinates.
Additionally, this update eliminates the need to attach event listeners to the entire window or the parent elements of the host element, simplifying the event handling and potentially improving performance.
2024-05-24 16:48:02 +02:00
94847d44f2 Update TODO comment 2024-05-24 11:11:57 +02:00
31934aa2c5 Optimize scroll event handling by limiting updates to rect positions only 2024-05-24 11:07:55 +02:00
76ba7788c0 Resolve overflow on X-axis issue and reimplement onScroll event listener 2024-05-24 10:13:12 +02:00
033b56329f Disable grammarly extension on host element 2024-05-24 08:50:24 +02:00
5871f38f26 Find a way to correctly position statusDiv element inside CKEditor. 2024-05-23 14:20:59 +02:00
Simon Rozman
94f55e0d7f service2.js: Revise 2024-05-23 12:35:12 +02:00
Simon Rozman
947d5048e6 service2.js: Remove resolved TODO 2024-05-23 12:17:34 +02:00
Simon Rozman
9258cecc73 service2.js: Reintroduce window resize event listening
This is an emergency solution to track host element position changing.
2024-05-23 12:16:54 +02:00
Simon Rozman
cb0f55a976 service2.js: Remove excessive markup repositioning
When window scrolls, our host element, correction panel and status icon
don't change their (left, top, right, bottom) document coordinates.
2024-05-23 12:08:17 +02:00
Simon Rozman
85d8f42dba service2.js: Simplify 2024-05-23 12:05:37 +02:00
Simon Rozman
273c96b78c service2.js: Mind horizontal scrolling, padding and margins too 2024-05-23 11:12:46 +02:00