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` ...@@ -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 {
......
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;
}; };
......
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