Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
W
wax-prosemirror
Manage
Activity
Members
Labels
Plan
Issues
34
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
2
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Container Registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
wax
wax-prosemirror
Commits
4226e2e7
Commit
4226e2e7
authored
4 years ago
by
chris
Browse files
Options
Downloads
Patches
Plain Diff
workaround for marking active
parent
82b801f6
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!186
add katex fonts
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
editors/editoria/src/layout/EditorElements.js
+6
-0
6 additions, 0 deletions
editors/editoria/src/layout/EditorElements.js
wax-prosemirror-utilities/src/document/DocumentHelpers.js
+23
-28
23 additions, 28 deletions
wax-prosemirror-utilities/src/document/DocumentHelpers.js
with
29 additions
and
28 deletions
editors/editoria/src/layout/EditorElements.js
+
6
−
0
View file @
4226e2e7
...
@@ -264,6 +264,12 @@ export default css`
...
@@ -264,6 +264,12 @@ export default css`
font-size: 0.95em;
font-size: 0.95em;
font-family: 'Consolas', 'Ubuntu Mono', monospace;
font-family: 'Consolas', 'Ubuntu Mono', monospace;
cursor: auto;
cursor: auto;
.ProseMirror {
box-shadow: none;
min-height: 100%;
padding: 0;
background: #eee;
}
}
}
.math-node.empty-math .math-render::before {
.math-node.empty-math .math-render::before {
...
...
This diff is collapsed.
Click to expand it.
wax-prosemirror-utilities/src/document/DocumentHelpers.js
+
23
−
28
View file @
4226e2e7
import
{
isObject
}
from
'
lodash
'
;
const
findMark
=
(
state
,
PMmark
,
toArr
=
false
)
=>
{
const
findMark
=
(
state
,
PMmark
,
toArr
=
false
)
=>
{
const
{
const
{
selection
:
{
$from
,
$to
},
selection
:
{
$from
,
$to
},
...
@@ -25,30 +27,11 @@ const findMark = (state, PMmark, toArr = false) => {
...
@@ -25,30 +27,11 @@ const findMark = (state, PMmark, toArr = false) => {
return
markFound
;
return
markFound
;
};
};
// const getSelectionMark = (state, PMmark) => {
/* TODO */
// const {
/* this is a hacky workaround for now to find marks
// selection: { $from, $to },
that are pm will break them. Correct way is to be done
// doc,
by the code that is comment out, but sometimes it doesn't return
// } = state;
the mark altouhgh it works for any other mark. Find out y?
// let markFound;
// doc.nodesBetween($from.pos, $to.pos, (node, from) => {
// if (node.marks) {
// const actualMark = node.marks.find(mark => mark.type === PMmark);
// if (actualMark) {
// markFound = {
// from,
// to: from + node.nodeSize,
// attrs: actualMark.attrs,
// };
// }
// }
// });
//
// return markFound;
// };
/* this is a workaround for now to find marks
that are pm will break them.
*/
*/
const
findFragmentedMark
=
(
state
,
PMmark
)
=>
{
const
findFragmentedMark
=
(
state
,
PMmark
)
=>
{
const
{
const
{
...
@@ -56,9 +39,24 @@ const findFragmentedMark = (state, PMmark) => {
...
@@ -56,9 +39,24 @@ const findFragmentedMark = (state, PMmark) => {
doc
,
doc
,
}
=
state
;
}
=
state
;
const
fromPos
=
[
$from
.
pos
-
1
,
$from
.
pos
];
const
fromPos
=
[
$from
.
pos
-
1
,
$from
.
pos
];
const
toPos
=
[
$to
.
pos
-
1
,
$to
.
pos
];
const
toPos
=
[
$to
.
pos
,
$to
.
pos
+
1
];
let
markFound
;
let
markFound
;
// const type = state.config.schema.marks.comment;
// const mark = empty
// ? type.isInSet(state.storedMarks || $from.marks())
// : state.doc.rangeHasMark(from, to, type);
//
// if (isObject(mark))
// return {
// from,
// to,
// attrs: mark.attrs,
// };
//
// // return undefined;
for
(
let
i
=
0
;
i
<
fromPos
.
length
;
i
++
)
{
for
(
let
i
=
0
;
i
<
fromPos
.
length
;
i
++
)
{
doc
.
nodesBetween
(
fromPos
[
i
],
toPos
[
i
],
(
node
,
from
)
=>
{
doc
.
nodesBetween
(
fromPos
[
i
],
toPos
[
i
],
(
node
,
from
)
=>
{
if
(
node
.
marks
)
{
if
(
node
.
marks
)
{
...
@@ -72,9 +70,6 @@ const findFragmentedMark = (state, PMmark) => {
...
@@ -72,9 +70,6 @@ const findFragmentedMark = (state, PMmark) => {
}
}
}
}
});
});
if
(
markFound
)
{
return
markFound
;
}
}
}
return
markFound
;
return
markFound
;
};
};
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
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