Skip to content

fix: handle typing in non editable paragraphs#97

Merged
IvanIhnatsiuk merged 1 commit into
developmentfrom
fix/handle-typing-in-non-editable-paragraph-ranges
Jun 3, 2026
Merged

fix: handle typing in non editable paragraphs#97
IvanIhnatsiuk merged 1 commit into
developmentfrom
fix/handle-typing-in-non-editable-paragraph-ranges

Conversation

@IvanIhnatsiuk

Copy link
Copy Markdown
Collaborator

Summary

This pull request introduces improved handling for inserting and deleting text around non-editable (read-only) paragraphs in both Android and iOS implementations of the Enriched Text Input. The changes ensure a more intuitive user experience when interacting with non-editable content, such as allowing insertion of new lines after non-editable paragraphs and enabling deletion of entire non-editable paragraphs with a single backspace.

Android Enhancements:

  • Improved insertion logic: When the cursor is immediately after a non-editable paragraph, inserting text will now automatically prepend a newline, allowing users to add content after non-editable sections more intuitively.
  • Added a helper method getNonEditableSpanBeforeCursor to detect non-editable spans directly before the cursor, supporting the improved insertion logic.
  • Enhanced deletion behavior: When deleting at the boundary of a non-editable paragraph, the entire non-editable paragraph is now removed in one action. This is managed by detecting the relevant span before deletion and removing it after the text change.

iOS Enhancements:

  • Improved text insertion: When attempting to insert text at the end of a read-only paragraph, the code now inserts a newline followed by the new text, ensuring proper separation and placement after the non-editable section.
  • Enhanced deletion logic: When deleting at the start of a range that follows a read-only paragraph, the entire non-editable paragraph is deleted in one action.

These changes improve the consistency and intuitiveness of editing text around non-editable paragraphs across platforms.

Test Plan

  1. Open the app
  2. Open the editor screen
  3. Try to type after a non-editable paragraph(MDF block divider, content block)
  4. Try to put the cursor right before the non-editable block
  5. Press on backspace

Provide clear steps so another contributor can reproduce the behavior or verify the feature works.
For example:

  • Steps to reproduce the bug (if this is a bug fix)
  • Steps to verify the new feature
  • Expected vs actual results
  • Any special conditions or edge cases to test

Screenshots / Videos

Screen.Recording.2026-06-04.at.01.05.12.mov
Screen.Recording.2026-06-04.at.01.06.59.mov

Compatibility

OS Implemented
iOS
Android

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR improves cross-platform editing behavior around non-editable (read-only) paragraph blocks in the Enriched Text Input, aiming to make typing after read-only blocks and deleting read-only blocks behave more intuitively and consistently on iOS and Android.

Changes:

  • iOS: add utilities to insert text after a read-only paragraph by auto-prepending a newline, and to delete an entire read-only paragraph in one backspace action.
  • iOS: extend ParagraphsUtils with an “at end of read-only paragraph” detector and wire the new insertion/deletion behaviors into UITextViewDelegate.
  • Android: adjust the non-editable paragraph input filter to allow insertion after a non-editable paragraph by prepending a newline, and add watcher logic to remove a non-editable paragraph span after a boundary backspace.

Reviewed changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
ios/utils/Text/TextInsertionUtils.mm Adds iOS helpers for inserting after / deleting read-only paragraphs.
ios/utils/Text/TextInsertionUtils.h Exposes new iOS helper APIs.
ios/utils/Text/ParagraphsUtils.mm Adds isAtEndOfReadOnlyParagraph detection.
ios/utils/Text/ParagraphsUtils.h Declares new paragraph utility API.
ios/EnrichedTextInputView.mm Integrates new iOS insertion/deletion behavior into text input delegate flow.
android/src/main/java/com/swmansion/enriched/watchers/EnrichedTextWatcher.kt Tracks and removes a non-editable paragraph span after boundary deletions.
android/src/main/java/com/swmansion/enriched/inputFilters/NonEditableParagraphFilter.kt Allows inserting after a non-editable paragraph by prepending a newline.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +121 to +128
NSRange readOnlyRange = NSMakeRange(0, 0);
id readOnly = [storage attribute:ReadOnlyParagraphKey
atIndex:range.location - 1
effectiveRange:&readOnlyRange];

if (readOnly == nil || NSMaxRange(readOnlyRange) < range.location) {
return NO;
}
@IvanIhnatsiuk IvanIhnatsiuk merged commit 3656703 into development Jun 3, 2026
1 check passed
@IvanIhnatsiuk IvanIhnatsiuk deleted the fix/handle-typing-in-non-editable-paragraph-ranges branch June 3, 2026 23:17
@HelgaBabut

Copy link
Copy Markdown

@IvanIhnatsiuk On web, when deleting a block from editor there is a confirmation dialog:

Saga.19.mp4

@IvanIhnatsiuk

Copy link
Copy Markdown
Collaborator Author

@HelgaBabut We have already discussed this with Marius and decided to postpone it until the redesign of planning items. https://github.com/7Mountains/7m-mobile/issues/882.

@Marius7Mountains could you confirm that?

@Marius7Mountains

Copy link
Copy Markdown

I think this is different from the redesign of the planning items, the first example a 2-step verification for deleting including option to also delete the task/planning item entirely everywhere (same as in https://github.com/7Mountains/7m-mobile/issues/882).

The second (in the instance editor) is a 2-step verification when the user attempts to delete a block. @HelgaBabut , to be honest I haven't seen this 2-step verification before in the instance editor, is it a user group setting perhaps to turn on verification?

@HelgaBabut

Copy link
Copy Markdown

I think this is different from the redesign of the planning items, the first example a 2-step verification for deleting including option to also delete the task/planning item entirely everywhere (same as in 7Mountains/7m-mobile#882).

The second (in the instance editor) is a 2-step verification when the user attempts to delete a block. @HelgaBabut , to be honest I haven't seen this 2-step verification before in the instance editor, is it a user group setting perhaps to turn on verification?

I don't think there is any group permission, I checked for feature flag and group permissions and did not find anything related to this. Did you test with automation blocks in the linear instance?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants