Enable start center in Emscripten build
...and let it open with that instead of with a hard-coded example.odt. (But keep that example.odt in CustomTarget,static_emscripten_fs_image and adapt the example code in static/README.wasm.md to explicitly load it now.) Change-Id: Ie43e3795e44542acba5a8e755f65acc56fa753f8 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/171019 Reviewed-by: Stephan Bergmann <stephan.bergmann@allotropia.de> Tested-by: Jenkins
This commit is contained in:
parent
33ea719d6c
commit
dd332f72ce
4 changed files with 21 additions and 7 deletions
|
@ -252,7 +252,7 @@ export ENABLE_WASM_STRIP_LANGUAGETOOL=@ENABLE_WASM_STRIP@
|
|||
export ENABLE_WASM_STRIP_LOCALES=@ENABLE_WASM_STRIP@
|
||||
export ENABLE_WASM_STRIP_PINGUSER=@ENABLE_WASM_STRIP@
|
||||
export ENABLE_WASM_STRIP_PREMULTIPLY=@ENABLE_WASM_STRIP@
|
||||
export ENABLE_WASM_STRIP_RECENT=@ENABLE_WASM_STRIP@
|
||||
export ENABLE_WASM_STRIP_RECENT=
|
||||
export ENABLE_WASM_STRIP_RECOVERYUI=@ENABLE_WASM_STRIP@
|
||||
export ENABLE_WASM_STRIP_SPLASH=@ENABLE_WASM_STRIP@
|
||||
export ENABLE_WASM_STRIP_SWEXPORTS=@ENABLE_WASM_STRIP@
|
||||
|
|
|
@ -185,7 +185,7 @@ $(if $(filter TRUE,$(ENABLE_QT5)), \
|
|||
sed -e 's/@APPNAME@/$(subst $(gb_Executable_EXT),,$(notdir $(1)))/' $(QT5_PLATFORMS_SRCDIR)/wasm_shell.html > $(dir $(1))qt_$(notdir $(1)) && \
|
||||
cp $(QT5_PLATFORMS_SRCDIR)/qtlogo.svg $(QT5_PLATFORMS_SRCDIR)/qtloader.js $(dir $(1)) && \
|
||||
,$(if $(filter TRUE,$(ENABLE_QT6)), \
|
||||
sed -e 's/@APPNAME@/$(basename $(notdir $(1)))/g' -e 's/@APPEXPORTNAME@/$(basename $(notdir $(1)))_entry/g' -e 's/@PRELOAD@//g' -e 's|const instance = await qtLoad$(OPEN_PAREN){|const instance = await qtLoad$(OPEN_PAREN){ "arguments": ["--norestore"$(COMMA) "--nologo"$(COMMA) "--writer"$(COMMA) "/android/default-document/example.odt"]$(COMMA)|' -e 's/}$(CLOSE_PAREN);$$/}$(CLOSE_PAREN); window.Module = instance;/' $(QT6_PLATFORMS_SRCDIR)/wasm_shell.html > $(dir $(1))qt_$(basename $(notdir $(1))).html && \
|
||||
sed -e 's/@APPNAME@/$(basename $(notdir $(1)))/g' -e 's/@APPEXPORTNAME@/$(basename $(notdir $(1)))_entry/g' -e 's/@PRELOAD@//g' -e 's|const instance = await qtLoad$(OPEN_PAREN){|const instance = await qtLoad$(OPEN_PAREN){ "arguments": ["--norestore"$(COMMA) "--nologo"]$(COMMA)|' -e 's/}$(CLOSE_PAREN);$$/}$(CLOSE_PAREN); window.Module = instance;/' $(QT6_PLATFORMS_SRCDIR)/wasm_shell.html > $(dir $(1))qt_$(basename $(notdir $(1))).html && \
|
||||
cp $(QT6_PLATFORMS_SRCDIR)/qtlogo.svg $(QT6_PLATFORMS_SRCDIR)/qtloader.js $(dir $(1)) && \
|
||||
)) \
|
||||
cp $(gb_CustomTarget_workdir)/static/emscripten_fs_image/soffice.data $(dir $(1))/soffice.data && \
|
||||
|
|
|
@ -182,7 +182,15 @@ Some usage examples through javascript of the current implementation:
|
|||
// inserts a string at the start of the Writer document.
|
||||
Module.uno_init.then(function() {
|
||||
const css = Module.uno.com.sun.star;
|
||||
const xModel = Module.getCurrentModelFromViewSh();
|
||||
let xModel = Module.getCurrentModelFromViewSh();
|
||||
if (xModel === null || !css.text.XTextDocument.query(xModel)) {
|
||||
const desktop = css.frame.Desktop.create(Module.getUnoComponentContext());
|
||||
const args = new Module.uno_Sequence_com$sun$star$beans$PropertyValue(
|
||||
0, Module.uno_Sequence.FromSize);
|
||||
xModel = css.frame.XComponentLoader.query(desktop).loadComponentFromURL(
|
||||
'file:///android/default-document/example.odt', '_default', 0, args);
|
||||
args.delete();
|
||||
}
|
||||
const xTextDocument = css.text.XTextDocument.query(xModel);
|
||||
const xText = xTextDocument.getText();
|
||||
const xTextCursor = xText.createTextCursor();
|
||||
|
@ -194,7 +202,15 @@ Module.uno_init.then(function() {
|
|||
// changes each paragraph of the Writer document to a random color.
|
||||
Module.uno_init.then(function() {
|
||||
const css = Module.uno.com.sun.star;
|
||||
const xModel = Module.getCurrentModelFromViewSh();
|
||||
let xModel = Module.getCurrentModelFromViewSh();
|
||||
if (xModel === null || !css.text.XTextDocument.query(xModel)) {
|
||||
const desktop = css.frame.Desktop.create(Module.getUnoComponentContext());
|
||||
const args = new Module.uno_Sequence_com$sun$star$beans$PropertyValue(
|
||||
0, Module.uno_Sequence.FromSize);
|
||||
xModel = css.frame.XComponentLoader.query(desktop).loadComponentFromURL(
|
||||
'file:///android/default-document/example.odt', '_default', 0, args);
|
||||
args.delete();
|
||||
}
|
||||
const xTextDocument = css.text.XTextDocument.query(xModel);
|
||||
const xText = xTextDocument.getText();
|
||||
const xEnumAccess = css.container.XEnumerationAccess.query(xText);
|
||||
|
|
|
@ -2,7 +2,5 @@
|
|||
|
||||
Module['arguments'] = [
|
||||
'--norestore',
|
||||
'--nologo',
|
||||
'--writer',
|
||||
'/android/default-document/example.odt'
|
||||
'--nologo'
|
||||
];
|
||||
|
|
Loading…
Reference in a new issue