Skip to content
Snippets Groups Projects
Commit 4226e2e7 authored by chris's avatar chris
Browse files

workaround for marking active

parent 82b801f6
No related branches found
No related tags found
1 merge request!186add katex fonts
......@@ -264,6 +264,12 @@ export default css`
font-size: 0.95em;
font-family: 'Consolas', 'Ubuntu Mono', monospace;
cursor: auto;
.ProseMirror {
box-shadow: none;
min-height: 100%;
padding: 0;
background: #eee;
}
}
.math-node.empty-math .math-render::before {
......
import { isObject } from 'lodash';
const findMark = (state, PMmark, toArr = false) => {
const {
selection: { $from, $to },
......@@ -25,30 +27,11 @@ const findMark = (state, PMmark, toArr = false) => {
return markFound;
};
// const getSelectionMark = (state, PMmark) => {
// const {
// selection: { $from, $to },
// doc,
// } = state;
// 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.
/* TODO */
/* this is a hacky workaround for now to find marks
that are pm will break them. Correct way is to be done
by the code that is comment out, but sometimes it doesn't return
the mark altouhgh it works for any other mark. Find out y?
*/
const findFragmentedMark = (state, PMmark) => {
const {
......@@ -56,9 +39,24 @@ const findFragmentedMark = (state, PMmark) => {
doc,
} = state;
const fromPos = [$from.pos - 1, $from.pos];
const toPos = [$to.pos - 1, $to.pos];
const toPos = [$to.pos, $to.pos + 1];
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++) {
doc.nodesBetween(fromPos[i], toPos[i], (node, from) => {
if (node.marks) {
......@@ -72,9 +70,6 @@ const findFragmentedMark = (state, PMmark) => {
}
}
});
if (markFound) {
return markFound;
}
}
return markFound;
};
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment