Skip to content
Snippets Groups Projects
Commit 1d0b5ecb authored by Christos's avatar Christos
Browse files

Merge branch 'remove-views' into 'master'

Remove views

See merge request !169
parents 3b46ee6d 38b61ada
No related branches found
No related tags found
1 merge request!169Remove views
...@@ -4,7 +4,10 @@ ...@@ -4,7 +4,10 @@
"version": "0.0.18", "version": "0.0.18",
"description": "Wax prosemirror UI components", "description": "Wax prosemirror UI components",
"license": "MIT", "license": "MIT",
"main": "index.js", "main": "dist/index.js",
"files": [
"dist"
],
"scripts": { "scripts": {
"test": "echo \"Error: no test specified\" && exit 1", "test": "echo \"Error: no test specified\" && exit 1",
"build": "BABEL_ENV=production rollup -c" "build": "BABEL_ENV=production rollup -c"
......
...@@ -16,6 +16,7 @@ export default ({ area }) => { ...@@ -16,6 +16,7 @@ export default ({ area }) => {
} = useContext(WaxContext); } = useContext(WaxContext);
const commentPlugin = app.PmPlugins.get('commentPlugin'); const commentPlugin = app.PmPlugins.get('commentPlugin');
const [marksNodes, setMarksNodes] = useState([]); const [marksNodes, setMarksNodes] = useState([]);
const [position, setPosition] = useState(); const [position, setPosition] = useState();
const [isFirstRun, setFirstRun] = useState(true); const [isFirstRun, setFirstRun] = useState(true);
...@@ -63,12 +64,15 @@ export default ({ area }) => { ...@@ -63,12 +64,15 @@ export default ({ area }) => {
markNodeEl.getBoundingClientRect().top - panelWrapperHeight - 50; markNodeEl.getBoundingClientRect().top - panelWrapperHeight - 50;
} }
let boxEl = null;
// get height of this markNode box // get height of this markNode box
const boxEl = document.querySelector(`div[data-box="${id}"]`); if (markNodeEl) {
boxEl = document.querySelector(`div[data-box="${id}"]`);
}
if (boxEl) boxHeight = parseInt(boxEl.offsetHeight, 10); if (boxEl) boxHeight = parseInt(boxEl.offsetHeight, 10);
// where the box should move to // where the box should move to
top = annotationTop; top = boxEl ? annotationTop : -2000;
// if the above comment box has already taken up the height, move down // if the above comment box has already taken up the height, move down
if (pos > 0) { if (pos > 0) {
...@@ -156,7 +160,6 @@ export default ({ area }) => { ...@@ -156,7 +160,6 @@ export default ({ area }) => {
return <>{CommentTrackComponent}</>; return <>{CommentTrackComponent}</>;
}; };
// TODO if allInlineNodes and allBlockNodes count don't change, do not compute again
const updateMarks = view => { const updateMarks = view => {
if (view.main) { if (view.main) {
const allInlineNodes = []; const allInlineNodes = [];
......
...@@ -4,7 +4,10 @@ ...@@ -4,7 +4,10 @@
"version": "0.0.18", "version": "0.0.18",
"description": "Wax prosemirror core", "description": "Wax prosemirror core",
"license": "MIT", "license": "MIT",
"main": "index.js", "main": "dist/index.js",
"files": [
"dist"
],
"scripts": { "scripts": {
"test": "echo \"Error: no test specified\" && exit 1", "test": "echo \"Error: no test specified\" && exit 1",
"build": "BABEL_ENV=production rollup -c" "build": "BABEL_ENV=production rollup -c"
......
...@@ -4,7 +4,10 @@ ...@@ -4,7 +4,10 @@
"version": "0.0.18", "version": "0.0.18",
"description": "Wax prosemirror layouts", "description": "Wax prosemirror layouts",
"license": "MIT", "license": "MIT",
"main": "index.js", "main": "dist/index.js",
"files": [
"dist"
],
"scripts": { "scripts": {
"test": "echo \"Error: no test specified\" && exit 1", "test": "echo \"Error: no test specified\" && exit 1",
"build": "BABEL_ENV=production rollup -c" "build": "BABEL_ENV=production rollup -c"
......
...@@ -4,7 +4,10 @@ ...@@ -4,7 +4,10 @@
"version": "0.0.18", "version": "0.0.18",
"description": "Wax prosemirror plugins", "description": "Wax prosemirror plugins",
"license": "MIT", "license": "MIT",
"main": "index.js", "main": "dist/index.js",
"files": [
"dist"
],
"scripts": { "scripts": {
"test": "echo \"Error: no test specified\" && exit 1", "test": "echo \"Error: no test specified\" && exit 1",
"build": "BABEL_ENV=production rollup -c" "build": "BABEL_ENV=production rollup -c"
......
...@@ -4,7 +4,10 @@ ...@@ -4,7 +4,10 @@
"version": "0.0.18", "version": "0.0.18",
"description": "Wax prosemirror schema", "description": "Wax prosemirror schema",
"license": "MIT", "license": "MIT",
"main": "index.js", "main": "dist/index.js",
"files": [
"dist"
],
"scripts": { "scripts": {
"test": "echo \"Error: no test specified\" && exit 1", "test": "echo \"Error: no test specified\" && exit 1",
"build": "BABEL_ENV=production rollup -c" "build": "BABEL_ENV=production rollup -c"
......
...@@ -4,7 +4,10 @@ ...@@ -4,7 +4,10 @@
"version": "0.0.18", "version": "0.0.18",
"description": "Wax prosemirror services", "description": "Wax prosemirror services",
"license": "MIT", "license": "MIT",
"main": "index.js", "main": "dist/index.js",
"files": [
"dist"
],
"scripts": { "scripts": {
"test": "echo \"Error: no test specified\" && exit 1", "test": "echo \"Error: no test specified\" && exit 1",
"build": "BABEL_ENV=production rollup -c" "build": "BABEL_ENV=production rollup -c"
......
import React, { useContext, useState, useMemo } from 'react'; import React, { useContext, useState, useMemo } from 'react';
import useDeepCompareEffect from 'use-deep-compare-effect'; import useDeepCompareEffect from 'use-deep-compare-effect';
import { differenceBy } from 'lodash';
import { WaxContext } from 'wax-prosemirror-core'; import { WaxContext } from 'wax-prosemirror-core';
import { DocumentHelpers } from 'wax-prosemirror-utilities'; import { DocumentHelpers } from 'wax-prosemirror-utilities';
import NoteEditor from './NoteEditor'; import NoteEditor from './NoteEditor';
...@@ -22,14 +22,17 @@ export default () => { ...@@ -22,14 +22,17 @@ export default () => {
); );
if (notes.length > currentNotes.length) { if (notes.length > currentNotes.length) {
// TODO remove from context views that no loger exist // TODO remove from context views that no loger exist
// console.log('to do cleanup'); const difference = differenceBy(notes, currentNotes, 'node.attrs.id');
difference.forEach((item, i) => {
// delete view[item.node.attrs.id];
});
} }
} }
}; };
useDeepCompareEffect(() => { useDeepCompareEffect(() => {
setNotes(updateNotes(main)); setNotes(updateNotes(main));
cleanUpNoteViews(); // cleanUpNoteViews();
}, [updateNotes(main)]); }, [updateNotes(main)]);
const noteComponent = useMemo( const noteComponent = useMemo(
......
...@@ -4,7 +4,10 @@ ...@@ -4,7 +4,10 @@
"version": "0.0.18", "version": "0.0.18",
"description": "Wax prosemirror themes", "description": "Wax prosemirror themes",
"license": "MIT", "license": "MIT",
"main": "index.js", "main": "dist/index.js",
"files": [
"dist"
],
"scripts": { "scripts": {
"test": "echo \"Error: no test specified\" && exit 1", "test": "echo \"Error: no test specified\" && exit 1",
"build": "BABEL_ENV=production rollup -c" "build": "BABEL_ENV=production rollup -c"
......
...@@ -4,7 +4,10 @@ ...@@ -4,7 +4,10 @@
"version": "0.0.18", "version": "0.0.18",
"description": "Wax prosemirror utilities", "description": "Wax prosemirror utilities",
"license": "MIT", "license": "MIT",
"main": "index.js", "main": "dist/index.js",
"files": [
"dist"
],
"scripts": { "scripts": {
"test": "echo \"Error: no test specified\" && exit 1", "test": "echo \"Error: no test specified\" && exit 1",
"build": "BABEL_ENV=production rollup -c" "build": "BABEL_ENV=production rollup -c"
......
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