Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
C
Ckeditor5 Complexitywiki Plugins
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
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
Ckeditor5 Complexitywiki Plugins
Commits
5dd66655
Commit
5dd66655
authored
3 years ago
by
Florian Spreckelsen
Browse files
Options
Downloads
Patches
Plain Diff
WIP: Begin MathJax plugin
parent
ea3c4773
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/mathjax_code_delimiters.js
+43
-0
43 additions, 0 deletions
src/mathjax_code_delimiters.js
with
43 additions
and
0 deletions
src/mathjax_code_delimiters.js
0 → 100644
+
43
−
0
View file @
5dd66655
import
{
Plugin
}
from
'
ckeditor/src/core
'
;
import
{
ButtonView
}
from
'
ckeditor/src/ui
'
;
export
default
class
MathJaxCodeDelimiters
extends
Plugin
{
static
get
pluginName
()
{
return
'
MathJaxCodeDelimiters
'
;
}
init
()
{
// This is well-defined since this class inherits from `Plugin`
const
editor
=
this
.
editor
;
const
model
=
editor
.
model
;
// Stay compatible to possible future translations
const
t
=
editor
.
t
;
// Add the inline-math button
editor
.
ui
.
componentFactory
.
add
(
'
inlineMathButton
'
,
locale
=>
{
const
view
=
new
ButtonView
(
locale
);
view
.
set
(
{
label
:
t
(
'
Insert inline math delimiters
'
),
icon
:
'
$
'
,
tooltip
:
true
,
isToggleable
:
true
}
);
// Insert the inline delimiters ("`$$`") into the text at the
// position of the cursor.
this
.
listenTo
(
view
,
'
execute
'
,
()
=>
{
model
.
change
(
writer
=>
{
const
textNode
=
writer
.
createText
(
'
`$$`
'
);
model
.
insertContent
(
textNode
);
}
);
editor
.
editing
.
view
.
focus
();
}
);
}
);
}
}
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