@voplus/morpho-document 6.0.31 → 6.0.32
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -1,17 +1,22 @@
|
|
|
1
1
|
import React, { useEffect, useState } from "react";
|
|
2
|
+
import { ApplicationContext, useApplicationContext } from "@voplus/morpho-data";
|
|
2
3
|
import MentionState from "../../controls/MentionState";
|
|
3
4
|
import ReactDOM from "react-dom";
|
|
4
5
|
import { State } from "./state";
|
|
5
6
|
import Viewer from "@voplus/morpho-text/es/controls/ProseMirror/Viewer";
|
|
6
7
|
import { observe } from "@voplus/morpho-ui";
|
|
7
8
|
import { useActivityStore } from "@voplus/morpho-org/es/data/ActivityStore";
|
|
9
|
+
import NoteAlertTip from "@voplus/morpho-org/es/components/NoteAlertTip";
|
|
8
10
|
const MentionViewer = (props) => {
|
|
9
11
|
const store = useActivityStore();
|
|
12
|
+
const context = useApplicationContext();
|
|
10
13
|
const [state] = useState(new State());
|
|
11
14
|
useEffect(() => {
|
|
12
15
|
return () => {
|
|
13
16
|
if (state.renderMention)
|
|
14
17
|
ReactDOM.unmountComponentAtNode(state.renderMention);
|
|
18
|
+
if (state.renderUnitNote)
|
|
19
|
+
ReactDOM.unmountComponentAtNode(state.renderUnitNote);
|
|
15
20
|
};
|
|
16
21
|
}, []);
|
|
17
22
|
return observe(() => (React.createElement(Viewer, { html: props.html, onPrepareMention: (mention, unitId) => {
|
|
@@ -19,6 +24,10 @@ const MentionViewer = (props) => {
|
|
|
19
24
|
state.renderMention.className = "mention-state";
|
|
20
25
|
ReactDOM.render(React.createElement(MentionState, { store: store, activityId: props.activityId, unitId: unitId }), state.renderMention);
|
|
21
26
|
mention.appendChild(state.renderMention);
|
|
27
|
+
state.renderUnitNote = document.createElement("span");
|
|
28
|
+
ReactDOM.render(React.createElement(ApplicationContext.Provider, { value: context },
|
|
29
|
+
React.createElement(NoteAlertTip, { id: unitId })), state.renderUnitNote);
|
|
30
|
+
mention.appendChild(state.renderUnitNote);
|
|
22
31
|
} })));
|
|
23
32
|
};
|
|
24
33
|
export default MentionViewer;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/services/MentionViewer/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/services/MentionViewer/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AACnD,OAAO,EAAE,kBAAkB,EAAE,qBAAqB,EAAE,MAAM,qBAAqB,CAAC;AAChF,OAAO,YAAY,MAAM,6BAA6B,CAAC;AACvD,OAAO,QAAQ,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAChC,OAAO,MAAM,MAAM,oDAAoD,CAAC;AACxE,OAAO,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAC5C,OAAO,EAAE,gBAAgB,EAAE,MAAM,0CAA0C,CAAC;AAC5E,OAAO,YAAY,MAAM,+CAA+C,CAAC;AAEzE,MAAM,aAAa,GAAG,CAAC,KAA4C,EAAE,EAAE;IACtE,MAAM,KAAK,GAAG,gBAAgB,EAAE,CAAC;IACjC,MAAM,OAAO,GAAG,qBAAqB,EAAE,CAAC;IACxC,MAAM,CAAC,KAAK,CAAC,GAAG,QAAQ,CAAC,IAAI,KAAK,EAAE,CAAC,CAAC;IAEtC,SAAS,CAAC,GAAG,EAAE;QACd,OAAO,GAAG,EAAE;YACX,IAAI,KAAK,CAAC,aAAa;gBAAE,QAAQ,CAAC,sBAAsB,CAAC,KAAK,CAAC,aAAa,CAAC,CAAC;YAC9E,IAAI,KAAK,CAAC,cAAc;gBAAE,QAAQ,CAAC,sBAAsB,CAAC,KAAK,CAAC,cAAc,CAAC,CAAC;QACjF,CAAC,CAAC;IACH,CAAC,EAAE,EAAE,CAAC,CAAC;IAEP,OAAO,OAAO,CAAC,GAAG,EAAE,CAAC,CACpB,oBAAC,MAAM,IACN,IAAI,EAAE,KAAK,CAAC,IAAI,EAChB,gBAAgB,EAAE,CAAC,OAAgB,EAAE,MAAc,EAAE,EAAE;YACtD,KAAK,CAAC,aAAa,GAAG,QAAQ,CAAC,aAAa,CAAC,GAAG,CAAC,CAAC;YAClD,KAAK,CAAC,aAAa,CAAC,SAAS,GAAG,eAAe,CAAC;YAChD,QAAQ,CAAC,MAAM,CACd,oBAAC,YAAY,IAAC,KAAK,EAAE,KAAK,EAAE,UAAU,EAAE,KAAK,CAAC,UAAU,EAAE,MAAM,EAAE,MAAM,GAAI,EAC5E,KAAK,CAAC,aAAa,CACnB,CAAC;YACF,OAAO,CAAC,WAAW,CAAC,KAAK,CAAC,aAAc,CAAC,CAAC;YAE1C,KAAK,CAAC,cAAc,GAAG,QAAQ,CAAC,aAAa,CAAC,MAAM,CAAC,CAAC;YACtD,QAAQ,CAAC,MAAM,CACd,oBAAC,kBAAkB,CAAC,QAAQ,IAAC,KAAK,EAAE,OAAO;gBAC1C,oBAAC,YAAY,IAAC,EAAE,EAAE,MAAM,GAAI,CACC,EAC9B,KAAK,CAAC,cAAc,CACpB,CAAC;YACF,OAAO,CAAC,WAAW,CAAC,KAAK,CAAC,cAAe,CAAC,CAAC;QAC5C,CAAC,GACA,CACF,CAAC,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,aAAa,CAAC"}
|
|
@@ -9,10 +9,19 @@ export class State {
|
|
|
9
9
|
writable: true,
|
|
10
10
|
value: void 0
|
|
11
11
|
});
|
|
12
|
+
Object.defineProperty(this, "renderUnitNote", {
|
|
13
|
+
enumerable: true,
|
|
14
|
+
configurable: true,
|
|
15
|
+
writable: true,
|
|
16
|
+
value: void 0
|
|
17
|
+
});
|
|
12
18
|
makeObservable(this);
|
|
13
19
|
}
|
|
14
20
|
}
|
|
15
21
|
__decorate([
|
|
16
22
|
observable
|
|
17
23
|
], State.prototype, "renderMention", void 0);
|
|
24
|
+
__decorate([
|
|
25
|
+
observable
|
|
26
|
+
], State.prototype, "renderUnitNote", void 0);
|
|
18
27
|
//# sourceMappingURL=state.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"state.js","sourceRoot":"","sources":["../../../src/services/MentionViewer/state.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,cAAc,EAAE,UAAU,EAAE,MAAM,MAAM,CAAC;AAElD,MAAM,OAAO,KAAK;
|
|
1
|
+
{"version":3,"file":"state.js","sourceRoot":"","sources":["../../../src/services/MentionViewer/state.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,cAAc,EAAE,UAAU,EAAE,MAAM,MAAM,CAAC;AAElD,MAAM,OAAO,KAAK;IACjB;QAGA,cAAc;QACK;;;;;WAA2B;QAC3B;;;;;WAA4B;QAJ9C,cAAc,CAAC,IAAI,CAAC,CAAC;IACtB,CAAC;CAID;AAFmB;IAAlB,UAAU;4CAAmC;AAC3B;IAAlB,UAAU;6CAAoC"}
|