Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
C
caosdb-webui
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
caosdb
Software
caosdb-webui
Commits
99d47ecc
Commit
99d47ecc
authored
3 years ago
by
Florian Spreckelsen
Browse files
Options
Downloads
Patches
Plain Diff
ENH: Clear list of saving callbacks after leaving the edit mode
parent
a6ca1e32
Branches
Branches containing commit
Tags
Tags containing commit
2 merge requests
!68
DOC: update CHANGELOG
,
!62
FIX: Save WYSIWYG saving in source mode
Pipeline
#18069
canceled
3 years ago
Stage: linting
Stage: test
Stage: deploy
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/core/js/ext_editmode_wysiwyg_text.js
+13
-36
13 additions, 36 deletions
src/core/js/ext_editmode_wysiwyg_text.js
with
13 additions
and
36 deletions
src/core/js/ext_editmode_wysiwyg_text.js
+
13
−
36
View file @
99d47ecc
...
...
@@ -64,40 +64,9 @@ var ext_editmode_wysiwyg_text = function ($, logger, ClassicEditor, edit_mode, g
logger
.
debug
(
'
Initialized editor for
'
+
getPropertyName
(
prop
));
// Manually implement saving the data since edit mode is not
// a form to be submitted.
_callOnSave
.
push
(()
=>
{
editor
.
updateSourceElement
()
});
//editor.model.document.on("change:data", (e) => {
//// console.log(editor.getData());
//// console.log(editor.sourceElement.value);
//console.log(editor.getData() != editor.sourceElement.value);
//if (editor.getData() != editor.sourceElement.value) {
//console.log("Saving editor...");
//editor.updateSourceElement();
//}
//});
// TODO(fspreck): Add an event listener to save also changes made in
// source mode. What event can we listen to? The following doesn't
// work either.
// document.body.addEventListener("input", e => {
// console.log("Saving after input...");
// editor.updateSourceElement();
// }, true);
//const sourceEditingPlugin = editor.plugins.get("SourceEditing");
//sourceEditingPlugin.on("change:isSourceEditingMode", (e, name, isSourceEditingMode) => {
//if (isSourceEditingMode) {
//// Maybe this helps?
//console.log("Entering source editing");
//const [domSourceEditingElementWrapper] = sourceEditingPlugin._replacedRoots.values();
//const textarea = domSourceEditingElementWrapper.querySelector('textarea');
//// TODO(fspreck) this has to be more intelligent since it
//// leads to an infinite update loop...
//textarea.addEventListener("input", (e) => {
//console.log("Input in source mode");
//// sourceEditingPlugin._updateEditorData();
//});
//}
//});
_callOnSave
.
push
(()
=>
{
editor
.
updateSourceElement
()
});
}
catch
(
error
)
{
logger
.
error
(
error
.
stack
);
}
...
...
@@ -105,8 +74,10 @@ var ext_editmode_wysiwyg_text = function ($, logger, ClassicEditor, edit_mode, g
const
proxySaveMethod
=
function
(
original
)
{
const
result
=
function
(
entity
)
{
_callOnSave
.
forEach
(
cb
=>
{
cb
();});
if
(
typeof
original
===
"
function
"
)
{
_callOnSave
.
forEach
(
cb
=>
{
cb
();
});
if
(
typeof
original
===
"
function
"
)
{
return
original
(
entity
);
}
return
undefined
;
...
...
@@ -154,6 +125,12 @@ var ext_editmode_wysiwyg_text = function ($, logger, ClassicEditor, edit_mode, g
logger
.
debug
(
'
Re-rendering
'
+
getPropertyName
(
e
.
target
));
ext_editmode_wysiwyg_text
.
insertEditorInProperty
(
e
.
target
);
},
true
);
// Clear list of saving callbacks when leaving the edit mode (regardless
// of saving or cancelling)
document
.
body
.
addEventListener
(
edit_mode
.
end_edit
.
type
,
(
e
)
=>
{
this
.
_callOnSave
=
[];
},
true
);
};
return
{
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment