-
-
Notifications
You must be signed in to change notification settings - Fork 62
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
enableReadOnlyMode & refactor upload_url to a class #195
Changes from all commits
f339c61
5d15dae
4643ba8
3ce6306
b521d55
2ef957c
5e12536
53be1af
33d4647
2843e58
9947797
b1e14b8
8ed1d27
8e79e4a
56c9791
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
from django.urls import path | ||
|
||
from . import views | ||
from .views import UploadImageView | ||
|
||
urlpatterns = [ | ||
path("image_upload/", views.upload_file, name="ck_editor_5_upload_file"), | ||
path("image_upload/", UploadImageView.as_view(), name="ck_editor_5_upload_image"), | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is a potentially breaking change if anyone uses There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @goapunk Well i decided to rename to image to be more semantic, considering the endpoint only allow upload images. Maybe is a good idea an this point create the changelog file and at least include the improvements in the next release, maybe the info:
|
||
] |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,7 +5,7 @@ | |
def test_upload_file(admin_client, file): | ||
with file as upload: | ||
response = admin_client.post( | ||
reverse("ck_editor_5_upload_file"), | ||
reverse("ck_editor_5_upload_image"), | ||
{"upload": upload}, | ||
) | ||
assert response.status_code == 200 | ||
|
@@ -19,7 +19,7 @@ def test_upload_file(admin_client, file): | |
def test_upload_file_to_google_cloud(admin_client, file, settings): | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this test is oddly now failing for me but I think that's because it was not actually using |
||
with file as upload: | ||
response = admin_client.post( | ||
reverse("ck_editor_5_upload_file"), | ||
reverse("ck_editor_5_upload_image"), | ||
{"upload": upload}, | ||
) | ||
assert response.status_code == 200 | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for your work on the code. Is it intended to use the same id for all editors?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@hvlads sorry. I don't understand
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Regarding the
lockId: string | symbol
parameter:This parameter serves as a unique identifier for setting the editor into a read-only state. It's essential to ensure that each
lock Id
is unique within your codebase.editor.enableReadOnlyMode( 'my-feature-id' );
editor.enableReadOnlyMode( 'my-other-feature-id' );
// ...
editor.disableReadOnlyMode( 'my-feature-id' );
editor.isReadOnly; //
true
.editor.disableReadOnlyMode( 'my-other-feature-id' );
editor.isReadOnly; //
false
.Parameters
lockId : string | symbol
A unique ID for setting the editor to the read-only state.
In the loop, you're adding "docs-snippet" to all editors with the "disabled" attribute.
Shouldn't we do this?
const lockId =
docs-snippet-${i}
;editor.enableReadOnlyMode(lockId);
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @Juanita, do you need any assistance with this? Also, I wanted to confirm if the class UploadImage View is still relevant now that files are being uploaded as well. Let me know if you need any clarification. Thanks!