Skip to content

Commit

Permalink
cds_deposit: Use apply on ckeditor readonly for immediate update
Browse files Browse the repository at this point in the history
  • Loading branch information
sakshamarora1 authored and zzacharo committed Nov 28, 2024
1 parent 90a8237 commit 9eb4b3f
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 8 deletions.
2 changes: 1 addition & 1 deletion cds/modules/invenio_deposit/views/ui.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ def new():
deposit_type = request.values.get("type")
return render_template(
current_app.config["DEPOSIT_UI_NEW_TEMPLATE"],
record={"_d`eposit": {"id": None}},
record={"_deposit": {"id": None}},
jsonschema=current_deposit.jsonschemas[deposit_type],
schemaform=current_deposit.schemaforms[deposit_type],
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -564,13 +564,15 @@ function cdsDepositCtrl(
true
);
$scope.$watch("$ctrl.record._deposit.status", function () {
Object.values($window.CKEDITOR.instances).forEach(function (instance) {
try {
instance.setReadOnly(instance.element.$.disabled);
} catch (error) {
// Do nothing probably not initialized yet
console.log(error);
}
$scope.$applyAsync(function () { // Manually trigger UI updates
Object.values($window.CKEDITOR.instances).forEach(function (instance) {
try {
instance.setReadOnly(instance.element.$.disabled);
} catch (error) {
// Do nothing probably not initialized yet
console.log(error);
}
});
});
});

Expand Down

0 comments on commit 9eb4b3f

Please sign in to comment.