Skip to content
Snippets Groups Projects
Commit 54c13f7d authored by Christos's avatar Christos
Browse files

Merge branch 'publish@0.9.18' into 'master'

Publish@0.9.18

See merge request !555
parents 2a065d79 7f974e5a
No related branches found
No related tags found
1 merge request!555Publish@0.9.18
Pipeline #60019 passed with stages
in 3 minutes and 32 seconds
{
"name": "demo",
"version": "0.9.17",
"version": "0.9.18",
"private": true,
"dependencies": {
"@guardian/prosemirror-invisibles": "^1.2.0",
......@@ -15,10 +15,10 @@
"typeface-fira-sans-condensed": "^0.0.54",
"typeface-inter": "^1.1.13",
"typeface-vollkorn": "^0.0.54",
"wax-prosemirror-core": "^0.9.17",
"wax-prosemirror-services": "^0.9.17",
"wax-questions-service": "^0.9.17",
"wax-table-service": "^0.9.17"
"wax-prosemirror-core": "^0.9.18",
"wax-prosemirror-services": "^0.9.18",
"wax-questions-service": "^0.9.18",
"wax-table-service": "^0.9.18"
},
"scripts": {
"start": "react-app-rewired start",
......
{
"lerna": "2.6.0",
"npmClient": "yarn",
"version": "0.9.17",
"version": "0.9.18",
"useWorkspaces": true
}
{
"name": "wax-prosemirror-core",
"author": "Christos Kokosias & Giannis Kopanas",
"version": "0.9.17",
"version": "0.9.18",
"description": "Wax prosemirror core",
"license": "MIT",
"main": "dist/index.js",
......
{
"name": "wax-prosemirror-services",
"author": "Christos Kokosias & Giannis Kopanas",
"version": "0.9.17",
"version": "0.9.18",
"description": "Wax prosemirror services",
"license": "MIT",
"main": "dist/index.js",
......@@ -36,7 +36,7 @@
"react-i18next": "^13.3.1",
"use-deep-compare-effect": "^1.3.1",
"uuid": "^7.0.3",
"wax-prosemirror-core": "^0.9.17",
"wax-prosemirror-core": "^0.9.18",
"y-prosemirror": "1.2.0",
"y-protocols": "1.0.5",
"y-webrtc": "10.2.0",
......
/* eslint react/prop-types: 0 */
import React, { useLayoutEffect, useContext } from 'react';
import { WaxContext } from 'wax-prosemirror-core';
import {
ySyncPluginKey,
relativePositionToAbsolutePosition,
absolutePositionToRelativePosition,
} from 'y-prosemirror';
import CommentBubble from './CommentBubble';
import { CommentDecorationPluginKey } from '../../../plugins/CommentDecorationPlugin';
......@@ -31,6 +36,10 @@ const CommentBubbleComponent = ({ setPosition, position, group }) => {
event.preventDefault();
const { selection } = state;
if (context.app.config.get('config.YjsService')) {
return createYjsComments(selection);
}
dispatch(
state.tr.setMeta(CommentDecorationPluginKey, {
type: 'addComment',
......@@ -52,6 +61,47 @@ const CommentBubbleComponent = ({ setPosition, position, group }) => {
dispatch(state.tr);
};
const createYjsComments = selection => {
const ystate = ySyncPluginKey.getState(state);
const { doc, type, binding } = ystate;
const from = absolutePositionToRelativePosition(
selection.from,
type,
binding.mapping,
);
const to = absolutePositionToRelativePosition(
selection.to,
type,
binding.mapping,
);
dispatch(
state.tr.setMeta(CommentDecorationPluginKey, {
type: 'addComment',
from: relativePositionToAbsolutePosition(
doc,
type,
from,
binding.mapping,
),
to: relativePositionToAbsolutePosition(doc, type, to, binding.mapping),
data: {
yjsFrom: selection.from,
yjsTo: selection.to,
pmFrom: selection.from,
pmTo: selection.to,
type: 'comment',
conversation: [],
title: '',
group,
viewId: activeViewId,
},
}),
);
dispatch(state.tr);
};
const isCommentAllowed = () => {
let allowed = true;
state.doc.nodesBetween(
......
......@@ -208,15 +208,10 @@ export default class CommentState {
if (ystate?.binding && ystate?.binding.mapping) {
this.updateCommentPostions(ystate);
this.createDecorations(state);
return this;
// eslint-disable-next-line no-else-return
} else {
map.forEach((annotation, _) => {
if ('from' in annotation && 'to' in annotation) {
annotation.from = transaction.mapping.map(annotation.from);
annotation.to = transaction.mapping.map(annotation.to);
}
});
this.createDecorations(state);
return this;
}
......
{
"name": "wax-questions-service",
"author": "Christos Kokosias & Giannis Kopanas",
"version": "0.9.17",
"version": "0.9.18",
"description": "Wax Questions Service",
"license": "MIT",
"main": "dist/index.js",
......@@ -32,7 +32,7 @@
"react-i18next": "^13.3.1",
"use-dynamic-refs": "^1.0.0",
"uuid": "^7.0.3",
"wax-prosemirror-core": "^0.9.17"
"wax-prosemirror-core": "^0.9.18"
},
"devDependencies": {
"mocha": "^3.4.2",
......
{
"name": "wax-table-service",
"author": "Christos Kokosias & Giannis Kopanas",
"version": "0.9.17",
"version": "0.9.18",
"description": "Wax Table Service",
"license": "MIT",
"main": "dist/index.js",
......@@ -23,7 +23,7 @@
"prosemirror-view": "1.30.2",
"react-i18next": "^13.3.1",
"uuid": "^7.0.3",
"wax-prosemirror-core": "^0.9.17"
"wax-prosemirror-core": "^0.9.18"
},
"devDependencies": {
"mocha": "^3.4.2",
......
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