Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Restricted editing in tables crash #6003

Closed
FilipTokarski opened this issue Dec 18, 2019 · 3 comments · Fixed by ckeditor/ckeditor5-restricted-editing#10
Closed

Restricted editing in tables crash #6003

FilipTokarski opened this issue Dec 18, 2019 · 3 comments · Fixed by ckeditor/ckeditor5-restricted-editing#10
Assignees
Labels
package:restricted-editing type:bug This issue reports a buggy (incorrect) behavior.

Comments

@FilipTokarski
Copy link
Member

📝 Provide detailed reproduction steps (if any)

  1. Create a table in standard mode
  2. Add some text in a table cell using exception marker
  3. Switch to restricted mode
  4. Try to type something in the same cell

✔️ Expected result

Exception marker should contain the provided text. User should not be able to write anywhere else in the table.

❌ Actual result

Exception marker splits into two parts, losing its text content, app crashes.

📃 Other details

  • Browser: any
  • OS: any
  • CKEditor version: 5

restricted_editing_table

Error when trying to type in the 'restricted' cell:

Uncaught TypeError: element.getCustomProperty(...) is not a function
    at DowncastDispatcher.<anonymous> (downcasthelpers.js:1053)
    at DowncastDispatcher.fire (emittermixin.js:209)
    at DowncastDispatcher.convertMarkerRemove (downcastdispatcher.js:386)
    at DowncastDispatcher.convertChanges (downcastdispatcher.js:131)
    at editingcontroller.js:92
    at View.change (view.js:468)
    at Document.EditingController.listenTo.priority (editingcontroller.js:91)
    at Document.fire (emittermixin.js:209)
    at Document._handleChangeBlock (document.js:318)
    at Model._runPendingChanges (model.js:787)

And then when trying to type anywhere else in the table:

ckeditorerror.js:66 Uncaught CKEditorError: model-nodelist-offset-out-of-bounds: Given offset cannot be found in the node list. Read more: https://ckeditor.com/docs/ckeditor5/latest/framework/guides/support/error-codes.html#error-model-nodelist-offset-out-of-bounds
 {"offset":2,"nodeList":[{"data":" "}]}
    at NodeList.offsetToIndex (http://localhost:8125/ckeditor5-restricted-editing/tests/manual/restrictedediting.js:52699:10)
    at Element.offsetToIndex (http://localhost:8125/ckeditor5-restricted-editing/tests/manual/restrictedediting.js:49710:25)
    at Position.get index [as index] (http://localhost:8125/ckeditor5-restricted-editing/tests/manual/restrictedediting.js:57800:22)
    at Position.get textNode [as textNode] (http://localhost:8125/ckeditor5-restricted-editing/tests/manual/restrictedediting.js:57811:43)
    at validateTextNodePosition (http://localhost:8125/ckeditor5-restricted-editing/tests/manual/restrictedediting.js:47894:33)
    at Document._validateSelectionRange (http://localhost:8125/ckeditor5-restricted-editing/tests/manual/restrictedediting.js:47803:10)
    at LiveSelection.<anonymous> (http://localhost:8125/ckeditor5-restricted-editing/tests/manual/restrictedediting.js:48971:26)
    at LiveSelection.fire (http://localhost:8125/ckeditor5-restricted-editing/tests/manual/restrictedediting.js:113448:30)
    at LiveSelection._setRanges (http://localhost:8125/ckeditor5-restricted-editing/tests/manual/restrictedediting.js:61898:8)
    at LiveSelection.setTo (http://localhost:8125/ckeditor5-restricted-editing/tests/manual/restrictedediting.js:61789:9)

If you'd like to see this fixed sooner, add a 👍 reaction to this post.

@FilipTokarski FilipTokarski added the type:bug This issue reports a buggy (incorrect) behavior. label Dec 18, 2019
@Mgsy
Copy link
Member

Mgsy commented Dec 18, 2019

I can confirm this issue.

@Reinmar
Copy link
Member

Reinmar commented Dec 18, 2019

cc @jodator

@jodator
Copy link
Contributor

jodator commented Dec 18, 2019

There's something wrong with upcast conversion.

<figure className="table">
	<table>
		<tbody>
			<tr>
				<td><span className="restricted-editing-exception">asdfadsf</span></td>
			</tr>
		</tbody>
	</table>
</figure>

Similar thing happens for marker inside caption element.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
package:restricted-editing type:bug This issue reports a buggy (incorrect) behavior.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants