Bug 149623 - Writer does not allow to view source for HTML when opened from Writer
Summary: Writer does not allow to view source for HTML when opened from Writer
Status: NEW
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Writer (show other bugs)
Version:
(earliest affected)
3.3.4 release
Hardware: x86-64 (AMD64) All
: medium normal
Assignee: Not Assigned
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: Writer-Web-Layout
  Show dependency treegraph
 
Reported: 2022-06-19 20:34 UTC by 10bxjfhf
Modified: 2025-02-19 16:21 UTC (History)
3 users (show)

See Also:
Crash report or crash signature:


Attachments
HTML file opened with Flatpak version. (298.33 KB, image/png)
2025-02-19 14:23 UTC, Klaus
Details
20250219-linux-flatpak.png (298.33 KB, image/png)
2025-02-19 14:24 UTC, Klaus
Details
20250219-windows.png (137.04 KB, image/png)
2025-02-19 14:27 UTC, Klaus
Details
20250219-webmode-broken-heading-level.png (20.07 KB, image/png)
2025-02-19 14:37 UTC, Klaus
Details

Note You need to log in before you can comment on or make changes to this bug.
Description 10bxjfhf 2022-06-19 20:34:26 UTC
Description:
Version 7.3.3.2 Windows has the menu entry View -? {}HTML Source but version 7.3.4.3 for Linux/Mint
https://gerrit.libreoffice.org/gitweb?p=core.git;a=log;h=728fec16bd5f605073805c3c9e7c4212a0120dc5

does NOT

Steps to Reproduce:
1.Load HTML file
2.Menu -> View -> no source view
3.

Actual Results:
no such entry, even in safe mode, cannot view HTML source under Linux

Expected Results:
provide the menu entry View -> HTML  Source

Alt-M shortcut does not work on Linux or Windows


Reproducible: Always


User Profile Reset: Yes



Additional Info:
[Information automatically included from LibreOffice]
Locale: en-US
Module: TextDocument
[Information guessed from browser]
OS: Linux (All)
OS is 64bit: yes
Version: 7.3.4.2 / LibreOffice Community
Build ID: 728fec16bd5f605073805c3c9e7c4212a0120dc5
CPU threads: 20; OS: Linux 5.15; UI render: default; VCL: gtk3
Locale: en-CA (en_CA.UTF-8); UI: en-US
Calc: threaded

OpenGL vendor string: Intel
OpenGL renderer string: Mesa Intel(R) UHD Graphics 630 (CML GT2)
OpenGL core profile version string: 4.6 (Core Profile) Mesa 21.2.6
OpenGL core profile shading language version string: 4.60
OpenGL core profile context flags: (none)
OpenGL core profile profile mask: core profile
OpenGL core profile extensions:
OpenGL version string: 4.6 (Compatibility Profile) Mesa 21.2.6
OpenGL shading language version string: 4.60
OpenGL context flags: (none)
OpenGL profile mask: compatibility profile
OpenGL extensions:
OpenGL ES profile version string: OpenGL ES 3.2 Mesa 21.2.6
OpenGL ES profile shading language version string: OpenGL ES GLSL ES 3.20
OpenGL ES profile extensions:
Comment 1 raal 2022-06-24 18:13:43 UTC
Works for me in Version: 7.2.7.2 / LibreOffice Community
Build ID: 20(Build:2)
CPU threads: 4; OS: Linux 5.13; UI render: default; VCL: gtk3
Locale: cs-CZ (cs_CZ.UTF-8); UI: cs-CZ
Ubuntu package version: 1:7.2.7-0ubuntu0.21.10.1
Calc: threaded
Comment 2 raal 2022-06-24 18:14:30 UTC
and Version: 7.4.0.0.beta1+ / LibreOffice Community
Build ID: 6ab56a4fc946f6294513f23a3ea47aa0aa154b7d
CPU threads: 4; OS: Linux 5.13; UI render: default; VCL: x11
Locale: cs-CZ (cs_CZ.UTF-8); UI: en-US
Calc: threaded Jumbo
Comment 3 Stéphane Guillou (stragu) 2022-12-20 13:35:27 UTC
Repro on both Windows and Ubuntu 20.04:

Version: 7.6.0.0.alpha0+ (X86_64) / LibreOffice Community
Build ID: 9b46020c262045aed0beace4708565235c2523cc
CPU threads: 4; OS: Windows 10.0 Build 19045; UI render: Skia/Raster; VCL: win
Locale: en-GB (en_GB); UI: en-GB
Calc: threaded

Version: 7.6.0.0.alpha0+ (X86_64) / LibreOffice Community
Build ID: ad387d5b984c6666906505d25685065f710ed55d
CPU threads: 8; OS: Linux 5.15; UI render: default; VCL: gtk3
Locale: en-AU (en_AU.UTF-8); UI: en-US
Calc: threaded

Note however that there's a difference:
- On both, can reproduce when opening the file from Writer (i.e. using the Open icon on the toolbar or File > Open)
- Only on Linux, I can reproduce when opening from the OS file browser, using Writer as the app. Not the case when using the general LibreOffice app, or on Windows with whatever option.
- On both, if the file is opened from the Start Center, it goes straight to Writer/Web mode (which can be seen in the titlebar) and allows looking at the source.

I guess this bug report could be reworded to "LibreOffice should always use Writer/Web when opening a HTML file" (if we do want to keep Writer/Web in LibreOffice) or "Writer should always allow seeing the source code of a HTML file" (if we don't). It already does switch to Writer/Web when creating a new HTML file.
Comment 4 QA Administrators 2024-12-20 03:12:21 UTC Comment hidden (obsolete)
Comment 5 Klaus 2025-02-19 14:23:35 UTC
Created attachment 199313 [details]
HTML file opened with Flatpak version.
Comment 6 Klaus 2025-02-19 14:24:20 UTC
Created attachment 199314 [details]
20250219-linux-flatpak.png
Comment 7 Klaus 2025-02-19 14:27:38 UTC
Created attachment 199315 [details]
20250219-windows.png
Comment 8 Klaus 2025-02-19 14:37:28 UTC
Created attachment 199316 [details]
20250219-webmode-broken-heading-level.png
Comment 9 Klaus 2025-02-19 14:46:14 UTC
As of today, I can reproduce the issue on Linux, but not on Windows.


ON LINUX VIA FLATPAK
====================

Behavior
--------
The HTML file is not opened in web mode. It is opened instead in a mode that looks like a standard writer document, see attachment 20250219-linux-flatpak.png.

View > HTML is not available.


Version
-------
Version: 25.2.0.3 (X86_64) / LibreOffice Community
Build ID: e1cf4a87eb02d755bce1a01209907ea5ddc8f069
CPU threads: 12; OS: Linux 6.4; UI render: default; VCL: gtk3
Locale: en-US (en_US.UTF-8); UI: en-US
Flatpak
Calc: threaded



ON WINDOWS VIA INSTALLER FROM WEBSITE
=====================================

Behavior
--------
Files open in "Writer/Web" mode as expected, and View > HTML Source is available.

New Bugs
--------

However, in this mode some other bugs can be observed:

  1   "File > Reload" is missing. 
      It can be still achieved by creating a custom key-binding for the
      "Reload" action.
  2a  Broken "Heading 1" is not recognized as a heading by the navigator (F5).
  2b  In "Tools > Heading Numbering", the level 1 has no associated style,
      matching 2a. See attachment: 20250219-webmode-broken-heading-level.png

These issues can be reproduced on Linux, when Writer is in web mode, which
is currently achievable only by creating a *new* html file.

The "Reload" action invoked on Linux does not switch the document from
Writer/Web to regular Writer mode, but closing the file and opening it
again does.

Version
-------
Version: 25.2.0.3 (X86_64) / LibreOffice Community
Build ID: e1cf4a87eb02d755bce1a01209907ea5ddc8f069
CPU threads: 8; OS: Windows 11 X86_64 (10.0 build 22631); UI render: Skia/Raster; VCL: win
Locale: en-US (en_AT); UI: en-GB
Calc: threaded
Comment 10 Klaus 2025-02-19 15:12:06 UTC
> However, in this mode some other bugs can be observed:
> 
>   1   "File > Reload" is missing. 
>       It can be still achieved by creating a custom key-binding for the
>       "Reload" action.
>   2a  Broken "Heading 1" is not recognized as a heading by the navigator
> (F5).
>   2b  In "Tools > Heading Numbering", the level 1 has no associated style,
>       matching 2a. See attachment: 20250219-webmode-broken-heading-level.png

I added separate bug reports for these:
https://bugs.documentfoundation.org/show_bug.cgi?id=165334
https://bugs.documentfoundation.org/show_bug.cgi?id=165335
Comment 11 Klaus 2025-02-19 16:21:55 UTC
Upon further analysis, the issues seems to be more about misconfiguration and
communication. Retesting (same versions as listed above), the behavior is

    CONSISTENT BETWEEN WINDOWS AND LINUX (mostly, see (2))               (1)

after all.

  - When opening a document from "Writer" it is opened as "Text Document",
    regardless of whether it is ODT or HTML.

  - When opening a document from "Writer/Web" it is opened as "HTML Document"
    regardless of whether it is ODT or HTML.

  - When opening a file with "LibreOffice", HTML documents are opened by
    "Writer/Web". The same holds for "LibreOffice Draw" and
    "LibreOffice Impress", but not for "LibreOffice Calc", which tries
    to import tables from the HTML file.

  - This corresponds to the shell commands

        libreoffice FILENAME
        libreoffice --writer FILENAME
        libreoffice --web FILENAME



WORKAROUND FOR FLATPAK VERSION
------------------------------
For the Flatpak version the solution then was to use the "LibreOffice"
application instead of the "LibreOffice Writer" application for opening
HTML files.

The Flatpak version does not install "Writer/Web" as a separate
application, so "LibreOffice Writer" can easily wrongly be chosen
as application for opening a HTML file.

On Windows, choosing "LibreOffice Writer" still opens in "Writer/Web",    (2)
the only Linux/Windows inconsistency I found after all (see (1)).



INCONSISTENCY BETWEEN LIBREOFFICE APPS
--------------------------------------
When doing

    libreoffice --calc FILENAME.odt

LibreOffice recognizes, that the wrong application is being used and picks
the suitable one (Writer for ODT).

By contrast,

    libreoffice --web    FILENAME.odt
    libreoffice --writer FILENAME.html

allow opening files in the "wrong" mode. The implied import/export
loop can lead to data loss in both directions. E.g. editing a HTML file
in "--writer" mode causes CSS classes to be lost.

This effectively introduces the imperfect "import/export" chain, that
editing Microsoft Office files suffers from due to the different concepts
of the formats, except for formats that Writer actually both supports
directly.

Note that

    libreoffice --calc FILENAME.html

DOES cause an import to Calc.



INCONSISTENCY ON "SAVE AS"
--------------------------
In Writer (--writer), "Save As" allows saving as HTML file, but does
not cause switching to Web mode.

In Writer/Web (--web), "Save As" to ODT is not supported. However,
export to ODT is supported.



"MY WISHLIST"
-------------
My preferred way of resolving the issues would be

  1. A dedicated explicit "Writer/Web" Start menu entry (both Linux
     and Windows) to give the separation more visibility.

  2. When opening HTML files with any other LibreOffice application,
     a choice between "importing" and "opening" (in Writer/Web)
     should be explicitly given where available (e.g. Calc, Writer),
     and Writer/Web should be the default otherwise (e.g. Impress,
     Draw).