Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
M
moodle-mod_pdfannotator
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
elc
moodle-mod_pdfannotator
Commits
12a641be
Unverified
Commit
12a641be
authored
3 years ago
by
Tim Schroeder
Browse files
Options
Downloads
Patches
Plain Diff
fix editing comments with mathjax formulas
parent
08346352
No related branches found
No related tags found
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
shared/index.js
+10
-8
10 additions, 8 deletions
shared/index.js
shared/locallib.js
+4
-4
4 additions, 4 deletions
shared/locallib.js
with
14 additions
and
12 deletions
shared/index.js
+
10
−
8
View file @
12a641be
...
@@ -416,7 +416,8 @@ function startIndex(Y,_cm,_documentObject,_contextId, _userid,_capabilities, _to
...
@@ -416,7 +416,8 @@ function startIndex(Y,_cm,_documentObject,_contextId, _userid,_capabilities, _to
if (data.status === "success") {
if (data.status === "success") {
$("#comment_" + commentId).addClass('dimmed_text'); // render chat box in grey.
$("#comment_" + commentId).addClass('dimmed_text'); // render chat box in grey.
$('#chatmessage' + commentId).append("<br><span id='taghidden" + commentId + "' class='tag tag-info'>" + M.util.get_string('hiddenforparticipants', 'pdfannotator') + "</span>");
$('#chatmessage' + commentId).append("<br><span id='taghidden" + commentId + "' class='tag tag-info'>" + M.util.get_string('hiddenforparticipants', 'pdfannotator') + "</span>");
renderMathJax();
let comment = document.getElementById("comment_" + commentId);
renderMathJax(comment);
notification.addNotification({
notification.addNotification({
message: M.util.get_string('successfullyHidden', 'pdfannotator'),
message: M.util.get_string('successfullyHidden', 'pdfannotator'),
type: "success"
type: "success"
...
@@ -452,7 +453,8 @@ function startIndex(Y,_cm,_documentObject,_contextId, _userid,_capabilities, _to
...
@@ -452,7 +453,8 @@ function startIndex(Y,_cm,_documentObject,_contextId, _userid,_capabilities, _to
if (data.status === "success") {
if (data.status === "success") {
$("#comment_" + commentId).removeClass('dimmed_text'); // render chat box in grey.
$("#comment_" + commentId).removeClass('dimmed_text'); // render chat box in grey.
$('#taghidden' + commentId).remove();
$('#taghidden' + commentId).remove();
renderMathJax();
let comment = document.getElementById("comment_" + commentId);
renderMathJax(comment);
notification.addNotification({
notification.addNotification({
message: M.util.get_string('successfullyRedisplayed', 'pdfannotator'),
message: M.util.get_string('successfullyRedisplayed', 'pdfannotator'),
type: "success"
type: "success"
...
@@ -1576,10 +1578,10 @@ function startIndex(Y,_cm,_documentObject,_contextId, _userid,_capabilities, _to
...
@@ -1576,10 +1578,10 @@ function startIndex(Y,_cm,_documentObject,_contextId, _userid,_capabilities, _to
let selector = '#comment_' + comment.uuid + ' .chat-message-text p';
let selector = '#comment_' + comment.uuid + ' .chat-message-text p';
let element = document.querySelector(selector);
renderMathJax(element);
});
});
// fixCommentForm();
// fixCommentForm();
renderMathJax();
//$("#comment_"+comment.uuid+" chat-message-p:contains('"+pattern+"')").addClass('mark');
//$("#comment_"+comment.uuid+" chat-message-p:contains('"+pattern+"')").addClass('mark');
//$("chat-message+:contains('text')").addClass('mark');
//$("chat-message+:contains('text')").addClass('mark');
...
@@ -1764,7 +1766,7 @@ function startIndex(Y,_cm,_documentObject,_contextId, _userid,_capabilities, _to
...
@@ -1764,7 +1766,7 @@ function startIndex(Y,_cm,_documentObject,_contextId, _userid,_capabilities, _to
} else if(newContent === comment.content) { // No changes.
} else if(newContent === comment.content) { // No changes.
editForm.style.display = "none";
editForm.style.display = "none";
text.innerHTML = comment.content;
text.innerHTML = comment.content;
renderMathJax();
renderMathJax(
text
);
} else { // Save changes.
} else { // Save changes.
_2.default.getStoreAdapter().editComment(documentId, comment.uuid, newContent)
_2.default.getStoreAdapter().editComment(documentId, comment.uuid, newContent)
.then(function(data){
.then(function(data){
...
@@ -1778,7 +1780,7 @@ function startIndex(Y,_cm,_documentObject,_contextId, _userid,_capabilities, _to
...
@@ -1778,7 +1780,7 @@ function startIndex(Y,_cm,_documentObject,_contextId, _userid,_capabilities, _to
newContent = data.newContent;
newContent = data.newContent;
text.innerHTML = newContent;
text.innerHTML = newContent;
comment.content = newContent;
comment.content = newContent;
renderMathJax();
renderMathJax(
text
);
notification.addNotification({
notification.addNotification({
message: M.util.get_string('successfullyEdited', 'pdfannotator'),
message: M.util.get_string('successfullyEdited', 'pdfannotator'),
type: "success"
type: "success"
...
@@ -1804,12 +1806,12 @@ function startIndex(Y,_cm,_documentObject,_contextId, _userid,_capabilities, _to
...
@@ -1804,12 +1806,12 @@ function startIndex(Y,_cm,_documentObject,_contextId, _userid,_capabilities, _to
$('#comment_' + comment.uuid + ' #commentCancel').click(function(e){
$('#comment_' + comment.uuid + ' #commentCancel').click(function(e){
editForm.style.display = "none";
editForm.style.display = "none";
text.innerHTML = comment.content;
text.innerHTML = comment.content;
renderMathJax();
renderMathJax(
text
);
});
});
} else {
} else {
editForm.style.display = "none";
editForm.style.display = "none";
text.innerHTML = comment.content;
text.innerHTML = comment.content;
renderMathJax();
renderMathJax(
text
);
}
}
}
}
// Create an element for click.
// Create an element for click.
...
...
This diff is collapsed.
Click to expand it.
shared/locallib.js
+
4
−
4
View file @
12a641be
...
@@ -83,18 +83,18 @@ function addDropdownNavigation(Y, __capabilities, __cmid) {
...
@@ -83,18 +83,18 @@ function addDropdownNavigation(Y, __capabilities, __cmid) {
}
}
function
renderMathJax
()
{
function
renderMathJax
(
node
)
{
var
counter
=
0
;
var
counter
=
0
;
let
mathjax
=
function
()
{
let
mathjax
=
function
(
node
)
{
if
(
typeof
(
MathJax
)
!==
"
undefined
"
)
{
if
(
typeof
(
MathJax
)
!==
"
undefined
"
)
{
MathJax
.
Hub
.
Queue
([
'
Typeset
'
,
MathJax
.
Hub
]);
MathJax
.
Hub
.
Queue
([
'
Typeset
'
,
MathJax
.
Hub
,
node
]);
}
else
if
(
counter
<
30
)
{
}
else
if
(
counter
<
30
)
{
counter
++
;
counter
++
;
setTimeout
(
mathjax
,
100
);
setTimeout
(
mathjax
,
100
);
}
else
{
}
else
{
}
}
};
};
mathjax
();
mathjax
(
node
);
}
}
function
fixCommentForm
()
{
function
fixCommentForm
()
{
...
...
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