fix: prevent audio source reset in disabled mode #1276
Closed
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Suneditor in disabled (read-only) mode.
Before:
![suneditor fix audio onInput (before)](https://private-user-images.githubusercontent.com/9049617/253722332-6a69032a-0fa8-4f6f-8db8-3593090b56c0.gif?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3Mzg5MDIzMzksIm5iZiI6MTczODkwMjAzOSwicGF0aCI6Ii85MDQ5NjE3LzI1MzcyMjMzMi02YTY5MDMyYS0wZmE4LTRmNmYtOGRiOC0zNTkzMDkwYjU2YzAuZ2lmP1gtQW16LUFsZ29yaXRobT1BV1M0LUhNQUMtU0hBMjU2JlgtQW16LUNyZWRlbnRpYWw9QUtJQVZDT0RZTFNBNTNQUUs0WkElMkYyMDI1MDIwNyUyRnVzLWVhc3QtMSUyRnMzJTJGYXdzNF9yZXF1ZXN0JlgtQW16LURhdGU9MjAyNTAyMDdUMDQyMDM5WiZYLUFtei1FeHBpcmVzPTMwMCZYLUFtei1TaWduYXR1cmU9M2RkOWZmYjA2YjcyMzcwZjIzMjk3YjdkMTIyNDc0ZjkxZGQ3ZDE0NTIxMmFlOWM5YzRmZjEyMGJjNmQwMjllMSZYLUFtei1TaWduZWRIZWFkZXJzPWhvc3QifQ.awnJVwl2zHS3A4MRPDkiy9RACD6pazRpNMcMBfnqcio)
After:
![suneditor fix audio onInput (after)](https://private-user-images.githubusercontent.com/9049617/253722343-863e93bb-cfed-4b9c-b4a1-0d42da0b058f.gif?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3Mzg5MDIzMzksIm5iZiI6MTczODkwMjAzOSwicGF0aCI6Ii85MDQ5NjE3LzI1MzcyMjM0My04NjNlOTNiYi1jZmVkLTRiOWMtYjRhMS0wZDQyZGEwYjA1OGYuZ2lmP1gtQW16LUFsZ29yaXRobT1BV1M0LUhNQUMtU0hBMjU2JlgtQW16LUNyZWRlbnRpYWw9QUtJQVZDT0RZTFNBNTNQUUs0WkElMkYyMDI1MDIwNyUyRnVzLWVhc3QtMSUyRnMzJTJGYXdzNF9yZXF1ZXN0JlgtQW16LURhdGU9MjAyNTAyMDdUMDQyMDM5WiZYLUFtei1FeHBpcmVzPTMwMCZYLUFtei1TaWduYXR1cmU9YTUyZmYzZWUzMDE0ZDhiZGJjN2UxZDgzN2M1ZmQ3ZGMwMGEzMGU5MGNkMjEzNzZjMTEwODFhNDJhOWQzOWVlMyZYLUFtei1TaWduZWRIZWFkZXJzPWhvc3QifQ.StVymby39Y_QpcYhzK8_GXYATuBnezsSFxlngSpTfUM)
P.S. @JiHong88 Another solution was to add
e.stopPropagation()
toaudio
elementonInput(e)
on its creation, but I thought that in the future this problem may affect other plugins, or we may need to handle some events inonInput_wysiwyg
, so I decided to place handler inonInput_wysiwyg
. You may reconsider it ;)P.P.S. Cool 'editMode' button I have, don't you think so? ;)