Commit graph

84 commits

Author SHA1 Message Date
Henry Castro
ad0f65be4d browser: if 'console.error' is invoked also invoke ...
'logServer' to save logging data to server side.

Change-Id: I7e5fd0d0f3aefaade1f34b98f9004af2579ba2bd
Signed-off-by: Henry Castro <hcastro@collabora.com>
2024-01-19 10:54:42 +00:00
Henry Castro
a722687c11 browser: simplify getParameterByName
Use built-in URLSearchParams object

Change-Id: I99effedabf39902ccabfa34285d62fc5df2d2e01
Signed-off-by: Henry Castro <hcastro@collabora.com>
2024-01-19 10:54:42 +00:00
Henry Castro
91a5831636 browser: simplify logServer
Use "fetch()" function to save logging client data
to server side.

Change-Id: I8b6a94b7ad7ae02ca00666759e3695867df4d372
Signed-off-by: Henry Castro <hcastro@collabora.com>
2024-01-19 10:54:42 +00:00
Neil Guertin
ae918ea449 Enable Idle test
Signed-off-by: Neil Guertin <neil.guertin@collabora.com>
Change-Id: I109e8c1b4e14be096741ceea5285456b77a38d04
2024-01-18 11:11:33 -05:00
Szymon Kłos
c991563fa9 Color selector: add no-fill as button
Make it more unified with "Office" color picker.
Use styling from jsdialog for color picker to match
all other ui components.

Unified with existing "Automatic" button for font color.

Signed-off-by: Szymon Kłos <szymon.klos@collabora.com>
Change-Id: I93d1031eaa7d3f3d52dc1812657eef20f4b88a82
2024-01-10 21:22:19 +01:00
Szymon Kłos
a5032aa54a Prevent from errors when palette doesn't exists
- in case we will remember in localStorage old name which is no longer
  present
- also add support dor DocumentColors when it will arrive
  from core

Signed-off-by: Szymon Kłos <szymon.klos@collabora.com>
Change-Id: I9d4b5d91f424c8295da072836331e459d79c96d1
2024-01-09 09:40:46 +01:00
Szymon Kłos
7a36a8ea1a Add color palette selector to Calc and Impress
It will be possible to use "theme colors" then.
It requires core part: https://gerrit.libreoffice.org/c/core/+/161771
sc: announce theme colors with lok callback

Signed-off-by: Szymon Kłos <szymon.klos@collabora.com>
Change-Id: I74552027f57086910358e589ff3130655a236c53
2024-01-09 09:40:46 +01:00
Skyler Grey
a31e6597cc Stop onscreen keyboards closing when used to move
This relies on core change I5e6c93c64af0d201a8ec045fea5546e189baca74
(https://gerrit.libreoffice.org/c/core/+/160313) as the logic to keep
the cell focused is from there.

Here we set the new option when there is an onscreen keyboard hint given
by ui_defaults or a postmessage. As ui_defaults are set at page load, we
need to wait to send our message until we're initializing everything
else to set our options. Additionally, we need to use the socket
directly rather than sending this through the map so that this bypasses
things like readonly mode

Signed-off-by: Skyler Grey <skyler.grey@collabora.com>
Change-Id: Ie6d80c0e1ebca607b9d705b673ab8008fae39260
Signed-off-by: Skyler Grey <skyler.grey@collabora.com>
2023-12-19 10:50:52 +00:00
Skyler Grey
61aa037ad9 Fix several regressions from touch unification
Touch unification (b3bff28bede07a48cdecefcda14a6fc9da86e4bb, change ID
I9016fc15ad3ccb3664af348fdcdca006495b0778) was a rework of the input
system to better support touch devices, but unfortunately it caused some
fairly serious regressions. This commit fixes the following:
- Triple/Quadruple clicking was no longer recognized on non-touch
  devices.
- There were some issues recognizing wrapped events
- Pens were considered to be touch devices, but this broke some
  remote/virtual machine setups. It's possible that this change will
  cause a regression for apple pencil users. I plan to get an Apple
  pencil to test whether preventing pens from being touch devices breaks
  the Apple pencil workflow instead
- manualDrag was taken to mean "is on a touch device". This is only
  almost true, causing some input to be incorrectly ingnored when it was
  not
- manualDrag and _manualDrag were confused. They affect different
  things, and we now recognize this

Signed-off-by: Skyler Grey <skyler.grey@collabora.com>
Change-Id: Iab0d3bcca588eaed14469597868a9c4e2dcf8488
Signed-off-by: Skyler Grey <skyler.grey@collabora.com>
2023-12-18 15:28:13 +01:00
Caolán McNamara
1bd1e5a828 wasm is derived from the mobile, but doesn't have on-screen keyboard
There's a bit of a mobile/wasm munge with wasm considered a subset
of mobile in some places which should be unwound a bit, but for the
purposes of usable wasm by default, don't assume that wasm has an
onscreen keyboard so we don't lose keystrokes on assuming that
there will be an onscreen keyboard appearing when we lose and regain
focus.

Signed-off-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Change-Id: I0baae0d414ce9aafd1c27d74bcdad2276d104ee5
2023-12-08 14:17:27 +00:00
Rash419
67aac9424b indirection: change request interval from 10s -> 3s
Signed-off-by: Rash419 <rashesh.padia@collabora.com>
Change-Id: I43c3bc5e1725f9d364c44638364f836e94f38290
2023-12-01 13:04:40 +05:30
Skyler Grey
e817f03785 Unify touchscreen handling, remove L.Browser.touch
L.Browser.touch is sometimes nice, but it's ultimately a flawed concept
to use it for input events. Using L.Browser.touch for input handicaps
people with mice if it's too liberal in what it classes as touchscreens,
and handicaps people with touchscreens if it's too conservative. There's
also no sweet spot: it's impossible to choose correctly if someone is
using both a touchscreen and a pointer device, as there's no right
option!

Previously many of our event handlers and some of our UI was gated
behind L.Browser.touch. This commit adds a new "window.touch" property
which is used instead. It has functions to help with event detection,
allowing you to easily make event handlers that work for only the input
devices they are designed for, without gating them behind feature
detection. This has the added bonus that - as you register all the
events - switching between a touchscreen and pointer is now not only
possible but already implemented!

For cases which don't have reasonable events to tag onto (e.g. the
teardrop for cursor movement) this commit adds "hasPrimaryTouchscreen"
and "hasAnyTouchscreen" which use the CSS media queries to detect if
there's a touchscreen attached to your device (either as the primary
input mechanism or at all). This works a lot more similarly to
L.Browser.mode, but being dynamically updated allows you to effectively
swich between touchscreen and not at-will. This still has all of the
disadvantages that L.Browser.touch did when used to register event
handlers, so my advice would be to avoid using it with events.

Signed-off-by: Skyler Grey <skyler.grey@collabora.com>
Change-Id: I9016fc15ad3ccb3664af348fdcdca006495b0778
2023-11-22 15:48:06 +01:00
Gabriel Masei
524e70eb47 fix language issue in datepicker control
It seems that datepicker control expects only a language input
in regional property (e.g. fr) instead of language-country (e.g. fr-FR).

Signed-off-by: Gabriel Masei <gabriel.masei@1and1.ro>
Change-Id: I7d5ac40cfa4a72cdc7862a8b4c4d14bdecad6c3b
2023-11-13 19:57:12 +05:30
Skyler Grey
ff1e4eeb57 Add a ui_defaults hint for touchscreens
At the moment, we try to detect whether the browser is running with a
touchscreen, however this is very imperfect. It's possible an integrator
may have more information about whether COOL is running on a device with
a touchscreen, so this ui_defaults option allows us to specify. Touch
mode binds inputs for touchscreen devices (long press for menu, pinch to
zoom, etc.) and does not bind the normal inputs (right click for menu,
etc.), so it's crucial to get it on all touch devices and no desktop
devices, as input is severely hampered if they are the wrong way round.

The option is called TouchscreenHint. Setting it to 'true' will enable
touchscreen mode, setting it to 'false' will disable touchscreen mode.
Leaving it undefined will keep our detection active.

This option must be set at page load so we can register the right
events at creation time. Therefore, ui_defaults is perfect as a method
to override this.

This is not a long-term solution. Instead, "The right thing" is to look
specifically for touch events and specifically for mouse events, rather
than using the default hammer.js behavior which is to look for both...
that should be an eventual followup to this. However, this was a lot
faster to implement and helps with the most pressing issue: not being
able to override our detection when it goes wrong.

Change-Id: Id28a156fe352fe6565ce6b472b7aa54d0869c48e
Signed-off-by: Skyler Grey <skyler.grey@collabora.com>
2023-11-10 23:20:22 +00:00
Skyler Grey
7175c7841b Add a ui_defaults option for onscreen keyboards
The new ui_defaults option OnscreenKeyboardHint is a tristate denoting
whether the device accessing Collabora Online has an onscreen keyboard

If unset, Collabora Online will do its best to guess. At time of
writing, this is the same as checking if the device is a mobile phone
or a tablet (note: only tablets which have the browser registered as a
"mobile" browser will be detected, e.g. the Microsoft Surface tablets
would not be detected)

If "true", Collabora will assume the device has an onscreen keyboard.
This will change when we trigger the keyboard, for example in calc if we
know of an onscreen keyboard we will not automatically focus a cell for
editing when it is selected, as this would pop up the keyboard.

If "false", Collabora will assume the device does not have an onscreen
keyboard, effectively doing the inverse of the "true" option above.

This is a followup to #7580 (0bf054c9a3)
which had Hint_OnscreenKeyboard and Hint_NoOnscreenKeyboard as
postmessage IDs to do the same thing.

Signed-off-by: Skyler Grey <skyler.grey@collabora.com>
Change-Id: I5deeb87a410c135d4cabda7ed24dc37e791800cd
2023-11-08 16:20:49 +00:00
Skyler Grey
13e3846ffe Add touch detection for pointer:course media query
matchMedia allows you to check matches for CSS media queries from
JavaScript. By checking if the primary pointer is 'course' we have a
pretty good shot at guessing that it's a touch device (mice, etc. are
'fine' instead). This expands our current touch detection so it detects
more screens, while making sure it doesn't detect devices which have a
touchscreen but also a mouse/touchpad/whatever. This non-detection is
important, because our touch support currently breaks things like the
rightclick menu on calc.

Touchscreen detection is useful for devices that are being used as touch
devices, because it enables some features like pinch-to-zoom and
hold-for-rightclick-menu which improve usability when you are using a
touchscreen. These are particularly important without a mouse.

Some devices are 2-in-1 laptops, which have a touchscreen and a
touchpad, but can be collapsed so only the touchscreen is active. These
devices will be detected as touch only when they are in their 'tablet'
form. *As we setup parts of the page differently, the page will need to
be refreshed if they change from tablet form to laptop form and
vice-versa*. Hopefully in the future we will make a followup so that
both input schemes can be enabled at the same time and extend this media
query detection to (any-pointer: course)

Signed-off-by: Skyler Grey <skyler.grey@collabora.com>
Change-Id: Ied4f61a1ffb06bd63359bc6d81c6a6c23436cc23
2023-11-08 14:39:47 +00:00
Skyler Grey
0bf054c9a3 Stop onscreen keyboard when panning calc on tablet
Before this change, panning a calc spreadsheet would cause the onscreen
keyboard to pop up when in tablet mode. Dismissing the keyboard would
not stop it from being popped up the next time you panned around. This
made it very difficult to pan around spreadsheets in calc without either
using an external keyboard, the mobile app or another device altogether.

This commit introduces a known regression: when you are on a tablet and
have a physical external keyboard, you could previously select the cell
and start typing. Now you must tap into the cell in the same way you
would if you have an onscreen keyboard. This matches the behavior on
mobile devices. I consider this regression a reasonable tradeoff, so
notwithstanding I believe this should be merged.

Additionally, this commit adds 2 POST messages, "Hint_OnscreenKeyboard"
and "Hint_NoOnscreenKeyboard". These can be used to override our guess
if you know more about whether the device has an onscreen keyboard than
we do.

Signed-off-by: Skyler Grey <skyler.grey@collabora.com>
Change-Id: I8f3683ccb9e57f0c4a5bf8e415f9aabef917dd78
2023-10-31 16:32:33 -04:00
Marco Cecchetti
09c18a4a44 a11y: keep a11y disabled on executing cypress Calc tests
This patch is a temporary workaround for fixing CI failures.
In fact on CI with a11y enabled cypress fails to load spreadsheets.

Signed-off-by: Marco Cecchetti <marco.cecchetti@collabora.com>
Change-Id: Ic661358cd47600ec9c3a329bef361b8087483017
2023-10-29 09:46:40 +00:00
Rash419
e290d07edb indirection: use errorcode to map errormsg and translate it
Signed-off-by: Rash419 <rashesh.padia@collabora.com>
Change-Id: I779bfc658c54255a675e3a047ed371e7e0586327
2023-10-06 15:52:21 +05:30
Marco Cecchetti
97aec60766 Firefox 117 no copy event is emitted by hitting CTRL+C with no selection
The problem affects no-a11y case since the editable area is empty.
Since no copy/cut event is emitted, Clipboard.copy/cut is never
invoked. So we need to emit it manually.
To be honest it seems a Firefox bug. We need to check if they fix it
in later version.

Signed-off-by: Marco Cecchetti <marco.cecchetti@collabora.com>
Change-Id: I036414b5ffb5b35ff1ef1d7de1044e890832c673
2023-09-19 19:16:43 +02:00
Rash419
cc3f12926c indirection: get new routeToken if serverId mismatch
Signed-off-by: Rash419 <rashesh.padia@collabora.com>
Change-Id: I0efb38b714894dffb44cb5e2ca06be12ccf43b89
2023-09-01 13:48:31 +05:30
Gökay Şatır
5485bea24e Add arrow key handlers for better accessibility support.
Signed-off-by: Gökay Şatır <gokaysatir@gmail.com>
Change-Id: I3f6e81797c63dbe3cc5742ff39382a4052225541
2023-08-04 12:29:19 +03:00
Gökay Şatır
14c84ac453 Improve accessibility of w2ui drop down menus.
Signed-off-by: Gökay Şatır <gokaysatir@gmail.com>
Change-Id: I9ff58eec19ccc7229c81b9d1f258bc8c4825634d
2023-08-04 12:29:19 +03:00
Gökay Şatır
54b16ea222 Make color buttons interactable with keyboard.
Signed-off-by: Gökay Şatır <gokaysatir@gmail.com>
Change-Id: Ibf35d6304a717a5870998fb761ca6630db5df4b2
2023-08-02 15:18:30 +03:00
Aron Budea
80a390f740 Revert "Fix wrong device detection logic."
On actual iPad (2048x1536 native, 1024x768 browser), in
landscape view in Safari, mobile phone view is shown in
online instead of tablet.

This reverts commit f1e9ee72fe.

Signed-off-by: Aron Budea <aron.budea@collabora.com>
Change-Id: I2cd4ba6cdcd616760c06c7db479e6d13be3d83b4
2023-07-26 10:08:58 +02:00
Rash419
55305d0d28 indirection: use Action_Load_Resp to show error msg
Signed-off-by: Rash419 <rashesh.padia@collabora.com>
Change-Id: I682973acfe45b9477bb6df9e8a17adf01e3dda65
2023-07-17 12:18:41 +05:30
Marco Cecchetti
abca8e5dd3 Adding support for enabling/disabling a11y support from the ui
Added toggle button/menu entry for enable/disable accessibility support.
This ui feature is available for Online Writer only.
The button/menu entry is added only when accessibility is enabled at
server level.
That allows to enable/disable accessibility per view.
By default, the accessibility support is disabled.
Anyway the accessibility support state is saved to local storage
if available.

Signed-off-by: Marco Cecchetti <marco.cecchetti@collabora.com>
Change-Id: If5968a47f17922038b9da3d320cbed84ebb7688b
2023-07-10 16:02:18 +02:00
Rash419
b717be603e implement document migration
- updated protocol.txt

Signed-off-by: Rash419 <rashesh.padia@collabora.com>
Change-Id: I67a0515580979e15223ea084c835f5ed801ceb5e
2023-06-29 18:21:33 +02:00
Rash419
ca5517cc24 indirecton:request again if we get 202 status
- also send 'App_LoadingStatus' postMessage with 'Loading_Progress'
  Status to notify integrator

Signed-off-by: Rash419 <rashesh.padia@collabora.com>
Change-Id: Ie754955c53d4d361d8dfaf083f7734382954d3f9
2023-06-29 18:21:33 +02:00
Szymon Kłos
9102357ee5 color palette: send the theme data in compact mode
Signed-off-by: Szymon Kłos <szymon.klos@collabora.com>
Change-Id: Ib4d77cea3ec3759841fa9c9d5e70f1cfd852fc16
2023-06-27 15:12:56 +02:00
Tomaž Vajngerl
3c38d78a5e color palette: send the theme data through UNO (when present)
Signed-off-by: Tomaž Vajngerl <tomaz.vajngerl@collabora.co.uk>
Change-Id: I245d34e323681add3552e808eee471821bd72a0c
2023-06-27 15:12:56 +02:00
Szymon Kłos
713bd070eb color palette: trigger callback with theme data
Signed-off-by: Szymon Kłos <szymon.klos@collabora.com>
Change-Id: Icce3ca11e9224f2bd8920e5ce9ff92e6d5ef5536
2023-06-27 15:12:56 +02:00
Szymon Kłos
d26a78495a color palette: show selector only in Writer
Signed-off-by: Szymon Kłos <szymon.klos@collabora.com>
Change-Id: Ifdf07cac131d4a1afdf758fd31af3d49b28ba3a6
2023-06-27 15:12:56 +02:00
Szymon Kłos
3372ea093c color palette: add palette selector
Signed-off-by: Szymon Kłos <szymon.klos@collabora.com>
Change-Id: Ie09715afbdbc50d783d6e50ce27dac2e2a06596a
2023-06-27 15:12:56 +02:00
Szymon Kłos
b32e3f1c9c color palette: use always the latest data
Signed-off-by: Szymon Kłos <szymon.klos@collabora.com>
Change-Id: I4fee6c3fc9e7e91d3e737f8ab93350cca8a2ecd0
2023-06-27 15:12:56 +02:00
Szymon Kłos
a44e2b1a37 color palette: convert core format to w2ui
Signed-off-by: Szymon Kłos <szymon.klos@collabora.com>
Change-Id: Id8980b0f7d34c011cc051f682299169952467b43
2023-06-27 15:12:56 +02:00
Szymon Kłos
e21925c65f color palette: move w2ui colors to docstate
Signed-off-by: Szymon Kłos <szymon.klos@collabora.com>
Change-Id: I037dd353ee143ecd5fd6182fa7aa3441588c0eb5
2023-06-27 15:12:56 +02:00
Henry Castro
3b7026c0e9 browser: add 'lang' property to get the current ...
browser language locale

Change-Id: Ia23d9710a0af97b4838f189e97cc0169d2294045
Signed-off-by: Henry Castro <hcastro@collabora.com>
2023-06-15 18:03:04 -04:00
Rash419
81834bc466 added serverId and routeToken in about dialog
Signed-off-by: Rash419 <rashesh.padia@collabora.com>
Change-Id: I498dd2a9f1fb08d9af116ac27ac645b31b87ed57
2023-06-05 21:27:50 +05:30
Marco Cecchetti
b9f9cef60a a11y: populating editable area with focused paragraph
We handle notification from core about currently focused paragraph:
content, caret position, text selection start/end.
Notifications are sent on any text changes, even when the text has
been modified in another view.
Moreover we can request such info to core at any time.
That allows AT software to read focused paragraph and selected text.
All that keeping editing still working.
A set of new cypress tests for checking clipboard content has been
developed.

failing cpp unit test:
- HTTPWSTest::testInactiveClient
'unexpected message' assertion was failing since an idle client can
receive an a11yfocuschanged message when the same paragraph has focus
in both view and the active view is editing the paragraph.

failing cypress tests:
desktop
- calc/autofilter_spec.js
  - added more wait time before performing clickOnFirstCell
- impress/undo_redo_spec.js
  - Repair Document was broken
    - we need to select 'Hello world' in order to overwrite it

mobile
- impress/spellchecking_spec.js
  - Apply suggestion
    - better use selectTextOfShape instead of Ctrl-A

Signed-off-by: Marco Cecchetti <marco.cecchetti@collabora.com>
Change-Id: I070d390543fa66fe786c4a0661fa09f891b9883e
2023-05-31 22:43:51 +02:00
Darshan-upadhyay1110
5548d062c8 Added image path for icons when toggle to dark theme
Signed-off-by: Darshan-upadhyay1110 <darshan.upadhyay@collabora.com>
Change-Id: I14a99df7cf10bf73f898f15d3aaa5a32c9cd51af
2023-05-25 11:13:18 +02:00
Darshan-upadhyay1110
fcfacd5081 removed An unknown button appears on top right of a document in android
Signed-off-by: Darshan-upadhyay1110 <darshan.upadhyay@collabora.com>
Change-Id: I6c0f1d62a19ecb55228012bef48373b97991461a
2023-05-24 14:00:20 +02:00
Ashod Nakashian
7d2f736084 browser: catch failure to get localization files
When we fail to download the localizaion javascript
file, for whatever reason, we end up failing to load
the document. This is far from ideal.
Instead, we simply log the error and move on.
The end result in such a failure scenario is that
the document loads, but the UI is only available
in English.

Change-Id: I5d29ff68870d0cd84d86658ccfd4e3185cc62562
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2023-05-03 06:52:25 -04:00
Gülşah Köse
f1e9ee72fe Fix wrong device detection logic.
window.screen.width/height returns the width/height
of the screen in CSS pixels. window.innerWidth/innerHeight
returns the interior width/height of the window in pixels.
This includes the width of the vertical scroll bar, if one is present.

That gives better result. eg: responsive mode

Signed-off-by: Gülşah Köse <gulsah.kose@collabora.com>
Change-Id: Ibecb9614224cb3bfd6d5d8dc9ad5febe6aa7673b
2023-05-03 12:30:28 +02:00
Michael Meeks
29d7937a46 proxy: get the length right for messages with content outside ASCII.
Interestingly, we've been sending the wrong length, resulting in

[ docbroker_003 ] ERR  #-1: Missing final newline| wsd/ProxyProtocol.cpp:158

type errors, as we read that back in coolwsd.

Change-Id: Iff7d1d38b0ed3e99c1d6903e2663c4335a36aaa3
Signed-off-by: Michael Meeks <michael.meeks@collabora.com>
2023-04-06 11:40:18 +02:00
Andras Timar
b0ff00961b handle Uncaught TypeError: Cannot read properties of null
sheets[i].href can be null. Seen with proxy.php.

Signed-off-by: Andras Timar <andras.timar@collabora.com>
Change-Id: I3d774ace869d141973a92abab8ef9ac83e1e0018
2023-04-05 20:57:16 +02:00
Gökay Şatır
6ddabcb792 Update sanitizeurl function calls.
Signed-off-by: Gökay Şatır <gokaysatir@collabora.com>
Change-Id: I07c12c072240307ea67d4f8f9ade8c1a9f63d1b8
2023-04-01 17:49:56 +03:00
Gökay Şatır
5bf2db45f9 Update sanitize-url package.
Signed-off-by: Gökay Şatır <gokaysatir@collabora.com>
Change-Id: Iab936fbf2e743dc1908cc978c2c4e5380f4ca47e
2023-04-01 17:49:56 +03:00
Gökay Şatır
aa47a9f0a9 Remove json-js and stylelint-config-standart packages.
We don't need the first one and we don't use the latter one.

Signed-off-by: Gökay Şatır <gokaysatir@collabora.com>
Change-Id: I1f48ff5487621781eb38dd8e4e8e2a389a3059d6
2023-04-01 11:30:07 +03:00
Gökay Şatır
260cbed5d3 Remove vex from code.
Signed-off-by: Gökay Şatır <gokaysatir@collabora.com>
Change-Id: I054977b5c71364c59c7f1fdd1f5d691380951ebb
2023-03-25 07:03:05 +03:00