Fix Scribe on responsive mobile

- Button was not added in MobileResponsiveAppBar
- Mobile behavior related scripts were not correctly added for web composer
- Mobile behavior related scripts return value was not properly handled for web composer
- In responsive web, bottomsheet modal clicks were intercepted by iframe behind
This commit is contained in:
Théo Poizat
2026-02-10 08:27:30 +01:00
committed by Dat H. Pham
parent 46a12745a5
commit 03a03b9088
6 changed files with 99 additions and 54 deletions
+12 -3
View File
@@ -220,9 +220,12 @@ class HtmlUtils {
const selection = window.getSelection();
if (selection && selection.rangeCount > 0) {
window._savedRange = selection.getRangeAt(0).cloneRange();
return selection.toString();
const result = selection.toString()
window.parent.postMessage(JSON.stringify({ "type": "toDart: saveSelection", result }), "*");
return result;
}
delete window._savedRange;
window.parent.postMessage(JSON.stringify({ "type": "toDart: saveSelection", result: "" }), "*");
return "";
})();''',
name: 'saveSelection');
@@ -236,9 +239,12 @@ class HtmlUtils {
selection.removeAllRanges();
selection.addRange(window._savedRange);
delete window._savedRange;
return selection.toString();
const result = selection.toString()
window.parent.postMessage(JSON.stringify({ "type": "toDart: restoreSelection", result }), "*");
return result;
}
}
window.parent.postMessage(JSON.stringify({ "type": "toDart: restoreSelection", result: "" }), "*");
return "";
})();''',
name: 'restoreSelection');
@@ -247,8 +253,11 @@ class HtmlUtils {
script: '''
(() => {
if(window._savedRange) {
return window._savedRange.toString();
const result = window._savedRange.toString();
window.parent.postMessage(JSON.stringify({ "type": "toDart: getSavedSelection", result }), "*");
return result;
} else {
window.parent.postMessage(JSON.stringify({ "type": "toDart: getSavedSelection", result: "" }), "*");
return "";
}
})();''',