- Decided to use mobile UI in mobile landscape
- Make mobile bottom sheet content scrollable except header and bottombar: bottom sheet will render correctly even if keyboard is opened and there is not a lot of space. It will be less usable than in portrait but all actions available.
- The context.mounted check was placed after onTapFallback?.call()
- The onTapFallback function calls controller.saveAndUnfocusForModal() which unfocuses the editor
- This caused the context to become unmounted so the context.mounted check would return early
- As a result the modal would never be show
- Use dependency injection and Get.find instead of manual singleton pattern
- Move from domain to data layer
- Prevents multiple API calls if the previous request hasn't finished
Before, our prompts were just a string like "Translate this text:
user text" and just before being sent to the backend, it was
converted to an "messages" object compatible with OpenAI API like [{
"role": "user", "content": "Translate this text: user text"}].
Now, we use "messages" object directly when building the prompt
because in the near future we will create more complex prompts with
system content and user content so we will need "messages" object
dirrectly.
- 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
- Support tap in addition to hover for context menu
- Improve clamping for greater screen sizes to avoid Scribe getting off screen
- Set a padding to 0 to avoid random padding depending on screen sizes
Previosuly, we display Scribe mobile (bottomsheet) if platform was mobile, so also Android or iOS tablet.
Now we choose to display Scribe mobile relatively to display screens instead of platform to display the desktop Scribe (context menu) for tablets.
Because the Scribe mobile is a full screen modal, we do not see the
current content (so either the selected text or entire composer text)
when selecting our AI actions.
That's why we add here a scrollable card that displays the current
content.
In recent commits I separated how we could add text in the editor. So
we need to escape HTML in both method that add text:
insertTextInEditor and setTextInEditor.
I had to extract the HTML escape part of
convertTextContentToHtmlContent because when using setTextInEditor we
do not need to convert \n to <br>.
- Add getSavedSelection to check saved selection without consuming it
- Distinguish between setText (replace all) and insertText (at cursor) operations
- Fix replace callback to use setText when no selection exists
- Clean up saved selection state after restoration in HTML utils
- Move mobile editor focus and selection restore to appropriate callbacks
- Fix Scribe replace on mobile when opened from menu bar (to be complete
this fix needs this PR https://github.com/Enough-Software/enough_html_editor/pull/37)
- Ensure all mobile editor call are awaited
- Do not clear text if a selection has been restored (which mean we replace a selection)
- Avoid collapseToEnd crash
enough_html_editor uses execCommand to insert HTML. However
execCommand only works if the contenteditable element is focused. So
inserting or replacing Scribe result do not work if the user did not
click before in the composer.
Here we manually focus the contenteditable element to fix this before
inserting content.
When opening Scribe mobile modal, we now unfocus the composer to hide the keyboard and the selection start and end icons from the OS.
Add new methods to save, restore, and clear text selection in HTML editor. These methods allow preserving and restoring user selection state when opening the Scribe mobile modal so that the "replace" action still works.
Same features than Scribe desktop but as a full screen modal instead of a context menu.
Reuse menu and submenu components.
Reuse suggestion components.
Reuse 99% of Scribe desktop style.
The button was never displayed because the selectionchange event listener was loaded when the WebView was not entirely loaded so selectionchange event were never fired.
Now we setup selection listener when the WebView is loaded instead of created.
Because the HTML editor is different, we need a different selector to get the editable element.
We also need to add a small offset to the coordinates to avoid positionning the overlay icon above native selection UI in mobile. For example, Android adds a marker at the beginning and the end of the selection and we do not want to display the Scribe overlay icon above this marker.