@univerjs/docs-drawing-ui 1.0.0-alpha.1 → 1.0.0-alpha.2
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.
- package/lib/cjs/index.js +46 -43
- package/lib/es/index.js +46 -43
- package/lib/index.js +46 -43
- package/lib/umd/index.js +1 -1
- package/package.json +12 -12
package/lib/index.js
CHANGED
|
@@ -23,14 +23,14 @@ const RemoveDocDrawingCommand = {
|
|
|
23
23
|
const commandService = accessor.get(ICommandService);
|
|
24
24
|
const univerInstanceService = accessor.get(IUniverInstanceService);
|
|
25
25
|
const renderManagerService = accessor.get(IRenderManagerService);
|
|
26
|
-
const documentDataModel = univerInstanceService.
|
|
26
|
+
const documentDataModel = univerInstanceService.getCurrentUnitOfType(UniverInstanceType.UNIVER_DOC);
|
|
27
27
|
if (params == null || documentDataModel == null) return false;
|
|
28
28
|
const docSelectionRenderService = renderManagerService.getRenderById(params.unitId).with(DocSelectionRenderService);
|
|
29
29
|
const { drawings: removeDrawings } = params;
|
|
30
30
|
const segmentId = (_docSelectionRenderSe = docSelectionRenderService.getSegment()) !== null && _docSelectionRenderSe !== void 0 ? _docSelectionRenderSe : "";
|
|
31
31
|
const textX = new TextX();
|
|
32
32
|
const jsonX = JSONX.getInstance();
|
|
33
|
-
const customBlocks = (_documentDataModel$ge = (_documentDataModel$ge2 = documentDataModel.getSelfOrHeaderFooterModel(segmentId).getBody()) === null || _documentDataModel$ge2 === void 0 ? void 0 : _documentDataModel$ge2.customBlocks) !== null && _documentDataModel$ge !== void 0 ? _documentDataModel$ge : [];
|
|
33
|
+
const customBlocks = (_documentDataModel$ge = (_documentDataModel$ge2 = documentDataModel.getSelfOrHeaderFooterModel(segmentId)) === null || _documentDataModel$ge2 === void 0 || (_documentDataModel$ge2 = _documentDataModel$ge2.getBody()) === null || _documentDataModel$ge2 === void 0 ? void 0 : _documentDataModel$ge2.customBlocks) !== null && _documentDataModel$ge !== void 0 ? _documentDataModel$ge : [];
|
|
34
34
|
const removeCustomBlocks = removeDrawings.map((drawing) => customBlocks.find((customBlock) => customBlock.blockId === drawing.drawingId)).filter((block) => !!block).sort((a, b) => a.startIndex > b.startIndex ? 1 : -1);
|
|
35
35
|
const unitId = removeDrawings[0].unitId;
|
|
36
36
|
const memoryCursor = new MemoryCursor();
|
|
@@ -129,13 +129,13 @@ const InsertDocDrawingCommand = {
|
|
|
129
129
|
id: "doc.command.insert-doc-image",
|
|
130
130
|
type: CommandType.COMMAND,
|
|
131
131
|
handler: (accessor, params) => {
|
|
132
|
-
var _ref, _contentInsertRange$s, _documentDataModel$ge, _documentDataModel$ge2;
|
|
132
|
+
var _ref, _contentInsertRange$s, _documentDataModel$ge, _documentDataModel$ge2, _documentDataModel$ge3;
|
|
133
133
|
if (params == null) return false;
|
|
134
134
|
const commandService = accessor.get(ICommandService);
|
|
135
135
|
const docSelectionManagerService = accessor.get(DocSelectionManagerService);
|
|
136
136
|
const univerInstanceService = accessor.get(IUniverInstanceService);
|
|
137
137
|
const activeTextRange = docSelectionManagerService.getActiveTextRange();
|
|
138
|
-
const documentDataModel = univerInstanceService.
|
|
138
|
+
const documentDataModel = univerInstanceService.getCurrentUnitOfType(UniverInstanceType.UNIVER_DOC);
|
|
139
139
|
if (documentDataModel == null) return false;
|
|
140
140
|
const unitId = documentDataModel.getUnitId();
|
|
141
141
|
const contentInsertRange = getContentInsertRange(accessor, unitId);
|
|
@@ -149,12 +149,12 @@ const InsertDocDrawingCommand = {
|
|
|
149
149
|
if (targetTextRange == null) return false;
|
|
150
150
|
const { drawings } = params;
|
|
151
151
|
const { collapsed, startOffset, segmentId = "" } = targetTextRange;
|
|
152
|
-
const body = documentDataModel.getSelfOrHeaderFooterModel(segmentId).getBody();
|
|
152
|
+
const body = (_documentDataModel$ge = documentDataModel.getSelfOrHeaderFooterModel(segmentId)) === null || _documentDataModel$ge === void 0 ? void 0 : _documentDataModel$ge.getBody();
|
|
153
153
|
if (body == null) return false;
|
|
154
154
|
const textX = new TextX();
|
|
155
155
|
const jsonX = JSONX.getInstance();
|
|
156
156
|
const rawActions = [];
|
|
157
|
-
const drawingOrderLength = (_documentDataModel$
|
|
157
|
+
const drawingOrderLength = (_documentDataModel$ge2 = (_documentDataModel$ge3 = documentDataModel.getSnapshot().drawingsOrder) === null || _documentDataModel$ge3 === void 0 ? void 0 : _documentDataModel$ge3.length) !== null && _documentDataModel$ge2 !== void 0 ? _documentDataModel$ge2 : 0;
|
|
158
158
|
let removeDrawingLen = 0;
|
|
159
159
|
if (collapsed) {
|
|
160
160
|
if (startOffset > 0) textX.push({
|
|
@@ -162,12 +162,12 @@ const InsertDocDrawingCommand = {
|
|
|
162
162
|
len: startOffset
|
|
163
163
|
});
|
|
164
164
|
} else {
|
|
165
|
-
var _documentDataModel$
|
|
165
|
+
var _documentDataModel$ge4, _documentDataModel$ge5;
|
|
166
166
|
const dos = BuildTextUtils.selection.delete([targetTextRange], body, 0, null, false);
|
|
167
167
|
textX.push(...dos);
|
|
168
168
|
const removedCustomBlockIds = getCustomBlockIdsInSelections(body, [targetTextRange]);
|
|
169
|
-
const drawings = (_documentDataModel$
|
|
170
|
-
const drawingOrder = (_documentDataModel$
|
|
169
|
+
const drawings = (_documentDataModel$ge4 = documentDataModel.getDrawings()) !== null && _documentDataModel$ge4 !== void 0 ? _documentDataModel$ge4 : {};
|
|
170
|
+
const drawingOrder = (_documentDataModel$ge5 = documentDataModel.getDrawingsOrder()) !== null && _documentDataModel$ge5 !== void 0 ? _documentDataModel$ge5 : [];
|
|
171
171
|
const sortedRemovedCustomBlockIds = removedCustomBlockIds.sort((a, b) => {
|
|
172
172
|
if (drawingOrder.indexOf(a) > drawingOrder.indexOf(b)) return -1;
|
|
173
173
|
else if (drawingOrder.indexOf(a) < drawingOrder.indexOf(b)) return 1;
|
|
@@ -800,12 +800,12 @@ function findDrawingAnchorInPage(page, drawingId, pageMarginTop, pageMarginLeft)
|
|
|
800
800
|
return null;
|
|
801
801
|
}
|
|
802
802
|
function getDeleteAndInsertCustomBlockActions(segmentId, oldSegmentId, segmentPage, offset, drawingId, documentDataModel, docSelectionRenderManager) {
|
|
803
|
-
var _oldBody$customBlocks;
|
|
803
|
+
var _documentDataModel$ge, _documentDataModel$ge2, _oldBody$customBlocks;
|
|
804
804
|
const textX = new TextX();
|
|
805
805
|
const jsonX = JSONX.getInstance();
|
|
806
806
|
const rawActions = [];
|
|
807
|
-
const oldBody = documentDataModel.getSelfOrHeaderFooterModel(oldSegmentId).getBody();
|
|
808
|
-
const body = documentDataModel.getSelfOrHeaderFooterModel(segmentId).getBody();
|
|
807
|
+
const oldBody = (_documentDataModel$ge = documentDataModel.getSelfOrHeaderFooterModel(oldSegmentId)) === null || _documentDataModel$ge === void 0 ? void 0 : _documentDataModel$ge.getBody();
|
|
808
|
+
const body = (_documentDataModel$ge2 = documentDataModel.getSelfOrHeaderFooterModel(segmentId)) === null || _documentDataModel$ge2 === void 0 ? void 0 : _documentDataModel$ge2.getBody();
|
|
809
809
|
if (oldBody == null || body == null) return;
|
|
810
810
|
const oldOffset = (_oldBody$customBlocks = oldBody.customBlocks) === null || _oldBody$customBlocks === void 0 || (_oldBody$customBlocks = _oldBody$customBlocks.find((block) => block.blockId === drawingId)) === null || _oldBody$customBlocks === void 0 ? void 0 : _oldBody$customBlocks.startIndex;
|
|
811
811
|
if (oldOffset == null) return;
|
|
@@ -916,7 +916,7 @@ const UpdateDocDrawingWrappingStyleCommand = {
|
|
|
916
916
|
const skeletonData = renderObject === null || renderObject === void 0 ? void 0 : renderObject.with(DocSkeletonManagerService).getSkeleton().getSkeletonData();
|
|
917
917
|
const viewModel = renderObject === null || renderObject === void 0 ? void 0 : renderObject.with(DocSkeletonManagerService).getViewModel();
|
|
918
918
|
const scene = renderObject === null || renderObject === void 0 ? void 0 : renderObject.scene;
|
|
919
|
-
const documentDataModel = univerInstanceService.
|
|
919
|
+
const documentDataModel = univerInstanceService.getCurrentUnitOfType(UniverInstanceType.UNIVER_DOC);
|
|
920
920
|
if (documentDataModel == null || skeletonData == null || scene == null || viewModel == null) return false;
|
|
921
921
|
const editArea = viewModel.getEditArea();
|
|
922
922
|
const transformer = scene.getTransformerByCreate();
|
|
@@ -1036,9 +1036,10 @@ const UpdateDocDrawingDistanceCommand = {
|
|
|
1036
1036
|
handler: (accessor, params) => {
|
|
1037
1037
|
if (params == null) return false;
|
|
1038
1038
|
const commandService = accessor.get(ICommandService);
|
|
1039
|
-
const
|
|
1040
|
-
if (documentDataModel == null) return false;
|
|
1039
|
+
const univerInstanceService = accessor.get(IUniverInstanceService);
|
|
1041
1040
|
const { drawings, dist, unitId } = params;
|
|
1041
|
+
const documentDataModel = univerInstanceService.getUnit(unitId, UniverInstanceType.UNIVER_DOC);
|
|
1042
|
+
if (documentDataModel == null) return false;
|
|
1042
1043
|
const jsonX = JSONX.getInstance();
|
|
1043
1044
|
const rawActions = [];
|
|
1044
1045
|
const { drawings: oldDrawings = {} } = documentDataModel.getSnapshot();
|
|
@@ -1080,9 +1081,10 @@ const UpdateDocDrawingWrapTextCommand = {
|
|
|
1080
1081
|
handler: (accessor, params) => {
|
|
1081
1082
|
if (params == null) return false;
|
|
1082
1083
|
const commandService = accessor.get(ICommandService);
|
|
1083
|
-
const
|
|
1084
|
-
if (documentDataModel == null) return false;
|
|
1084
|
+
const univerInstanceService = accessor.get(IUniverInstanceService);
|
|
1085
1085
|
const { drawings, wrapText, unitId } = params;
|
|
1086
|
+
const documentDataModel = univerInstanceService.getUnit(unitId, UniverInstanceType.UNIVER_DOC);
|
|
1087
|
+
if (documentDataModel == null) return false;
|
|
1086
1088
|
const jsonX = JSONX.getInstance();
|
|
1087
1089
|
const rawActions = [];
|
|
1088
1090
|
const { drawings: oldDrawings = {} } = documentDataModel.getSnapshot();
|
|
@@ -1123,13 +1125,14 @@ const UpdateDrawingDocTransformCommand = {
|
|
|
1123
1125
|
if (params == null) return false;
|
|
1124
1126
|
const commandService = accessor.get(ICommandService);
|
|
1125
1127
|
const univerInstanceService = accessor.get(IUniverInstanceService);
|
|
1126
|
-
const
|
|
1128
|
+
const renderManagerService = accessor.get(IRenderManagerService);
|
|
1129
|
+
const { drawings, unitId } = params;
|
|
1130
|
+
const renderObject = renderManagerService.getRenderUnitById(unitId);
|
|
1127
1131
|
const scene = renderObject === null || renderObject === void 0 ? void 0 : renderObject.scene;
|
|
1128
1132
|
if (scene == null) return false;
|
|
1129
1133
|
const transformer = scene.getTransformerByCreate();
|
|
1130
|
-
const documentDataModel = univerInstanceService.
|
|
1134
|
+
const documentDataModel = univerInstanceService.getUnit(unitId, UniverInstanceType.UNIVER_DOC);
|
|
1131
1135
|
if (documentDataModel == null) return false;
|
|
1132
|
-
const { drawings, unitId } = params;
|
|
1133
1136
|
const jsonX = JSONX.getInstance();
|
|
1134
1137
|
const rawActions = [];
|
|
1135
1138
|
const { drawings: oldDrawings = {} } = documentDataModel.getSnapshot();
|
|
@@ -1172,18 +1175,18 @@ const IMoveInlineDrawingCommand = {
|
|
|
1172
1175
|
handler: (accessor, params) => {
|
|
1173
1176
|
var _renderManagerService, _docSelectionRenderSe;
|
|
1174
1177
|
if (params == null) return false;
|
|
1178
|
+
const { drawing, unitId, offset, segmentId: newSegmentId, segmentPage, needRefreshDrawings } = params;
|
|
1175
1179
|
const renderManagerService = accessor.get(IRenderManagerService);
|
|
1176
|
-
const docSelectionRenderService = (_renderManagerService = renderManagerService.
|
|
1180
|
+
const docSelectionRenderService = (_renderManagerService = renderManagerService.getRenderUnitById(unitId)) === null || _renderManagerService === void 0 ? void 0 : _renderManagerService.with(DocSelectionRenderService);
|
|
1177
1181
|
const docRefreshDrawingsService = accessor.get(DocRefreshDrawingsService);
|
|
1178
|
-
const renderObject = renderManagerService.
|
|
1182
|
+
const renderObject = renderManagerService.getRenderUnitById(unitId);
|
|
1179
1183
|
const scene = renderObject === null || renderObject === void 0 ? void 0 : renderObject.scene;
|
|
1180
1184
|
const skeleton = renderObject === null || renderObject === void 0 ? void 0 : renderObject.with(DocSkeletonManagerService).getSkeleton();
|
|
1181
1185
|
if (scene == null || docSelectionRenderService == null) return false;
|
|
1182
1186
|
const transformer = scene.getTransformerByCreate();
|
|
1183
1187
|
const commandService = accessor.get(ICommandService);
|
|
1184
|
-
const documentDataModel = accessor.get(IUniverInstanceService).
|
|
1188
|
+
const documentDataModel = accessor.get(IUniverInstanceService).getUnit(unitId, UniverInstanceType.UNIVER_DOC);
|
|
1185
1189
|
if (documentDataModel == null) return false;
|
|
1186
|
-
const { drawing, unitId, offset, segmentId: newSegmentId, segmentPage, needRefreshDrawings } = params;
|
|
1187
1190
|
if (needRefreshDrawings) {
|
|
1188
1191
|
docRefreshDrawingsService.refreshDrawings(skeleton);
|
|
1189
1192
|
transformer.refreshControls();
|
|
@@ -1223,16 +1226,16 @@ const ITransformNonInlineDrawingCommand = {
|
|
|
1223
1226
|
handler: (accessor, params) => {
|
|
1224
1227
|
var _renderManagerService2, _docSelectionRenderSe2;
|
|
1225
1228
|
if (params == null) return false;
|
|
1229
|
+
const { drawing, unitId, offset, docTransform, segmentId: newSegmentId, segmentPage } = params;
|
|
1226
1230
|
const renderManagerService = accessor.get(IRenderManagerService);
|
|
1227
|
-
const docSelectionRenderService = (_renderManagerService2 = renderManagerService.
|
|
1228
|
-
const renderObject = renderManagerService.
|
|
1231
|
+
const docSelectionRenderService = (_renderManagerService2 = renderManagerService.getRenderUnitById(unitId)) === null || _renderManagerService2 === void 0 ? void 0 : _renderManagerService2.with(DocSelectionRenderService);
|
|
1232
|
+
const renderObject = renderManagerService.getRenderUnitById(unitId);
|
|
1229
1233
|
const scene = renderObject === null || renderObject === void 0 ? void 0 : renderObject.scene;
|
|
1230
1234
|
if (scene == null || docSelectionRenderService == null) return false;
|
|
1231
1235
|
const transformer = scene.getTransformerByCreate();
|
|
1232
1236
|
const commandService = accessor.get(ICommandService);
|
|
1233
|
-
const documentDataModel = accessor.get(IUniverInstanceService).
|
|
1237
|
+
const documentDataModel = accessor.get(IUniverInstanceService).getUnit(unitId, UniverInstanceType.UNIVER_DOC);
|
|
1234
1238
|
if (documentDataModel == null) return false;
|
|
1235
|
-
const { drawing, unitId, offset, docTransform, segmentId: newSegmentId, segmentPage } = params;
|
|
1236
1239
|
const rawActions = [];
|
|
1237
1240
|
const { drawingId } = drawing;
|
|
1238
1241
|
const actions = getDeleteAndInsertCustomBlockActions(newSegmentId, (_docSelectionRenderSe2 = docSelectionRenderService.getSegment()) !== null && _docSelectionRenderSe2 !== void 0 ? _docSelectionRenderSe2 : "", segmentPage, offset, drawingId, documentDataModel, docSelectionRenderService);
|
|
@@ -1313,7 +1316,7 @@ const MoveDocDrawingsCommand = {
|
|
|
1313
1316
|
const scene = renderObject === null || renderObject === void 0 ? void 0 : renderObject.scene;
|
|
1314
1317
|
if (scene == null) return false;
|
|
1315
1318
|
const transformer = scene.getTransformerByCreate();
|
|
1316
|
-
const documentDataModel = univerInstanceService.
|
|
1319
|
+
const documentDataModel = univerInstanceService.getUnit(unitId, UniverInstanceType.UNIVER_DOC);
|
|
1317
1320
|
const newDrawings = drawings.map((drawing) => {
|
|
1318
1321
|
var _documentDataModel$ge;
|
|
1319
1322
|
const { drawingId } = drawing;
|
|
@@ -1669,8 +1672,8 @@ const getDisableWhenSelectionInTableObservable = (accessor) => {
|
|
|
1669
1672
|
if (activeRange) {
|
|
1670
1673
|
var _docDataModel$getSelf;
|
|
1671
1674
|
const { segmentId, startOffset, endOffset } = activeRange;
|
|
1672
|
-
const docDataModel = univerInstanceService.
|
|
1673
|
-
const tables = docDataModel === null || docDataModel === void 0 || (_docDataModel$getSelf = docDataModel.getSelfOrHeaderFooterModel(segmentId).getBody()) === null || _docDataModel$getSelf === void 0 ? void 0 : _docDataModel$getSelf.tables;
|
|
1675
|
+
const docDataModel = univerInstanceService.getCurrentUnitOfType(UniverInstanceType.UNIVER_DOC);
|
|
1676
|
+
const tables = docDataModel === null || docDataModel === void 0 || (_docDataModel$getSelf = docDataModel.getSelfOrHeaderFooterModel(segmentId)) === null || _docDataModel$getSelf === void 0 || (_docDataModel$getSelf = _docDataModel$getSelf.getBody()) === null || _docDataModel$getSelf === void 0 ? void 0 : _docDataModel$getSelf.tables;
|
|
1674
1677
|
if (tables && tables.length) {
|
|
1675
1678
|
if (tables.some((table) => {
|
|
1676
1679
|
const { startIndex, endIndex } = table;
|
|
@@ -1784,7 +1787,7 @@ function InsertEllipseShapeBelowMenuFactory(accessor) {
|
|
|
1784
1787
|
//#endregion
|
|
1785
1788
|
//#region package.json
|
|
1786
1789
|
var name = "@univerjs/docs-drawing-ui";
|
|
1787
|
-
var version = "1.0.0-alpha.
|
|
1790
|
+
var version = "1.0.0-alpha.2";
|
|
1788
1791
|
|
|
1789
1792
|
//#endregion
|
|
1790
1793
|
//#region src/config/config.ts
|
|
@@ -1821,7 +1824,7 @@ const DocDrawingPosition = (props) => {
|
|
|
1821
1824
|
const drawingParam = drawings[0];
|
|
1822
1825
|
if (drawingParam == null) return;
|
|
1823
1826
|
const { unitId } = drawingParam;
|
|
1824
|
-
const documentDataModel = univerInstanceService.
|
|
1827
|
+
const documentDataModel = univerInstanceService.getUnit(unitId, UniverInstanceType.UNIVER_DOC);
|
|
1825
1828
|
const documentFlavor = documentDataModel === null || documentDataModel === void 0 ? void 0 : documentDataModel.getSnapshot().documentStyle.documentFlavor;
|
|
1826
1829
|
const renderObject = renderManagerService.getRenderById(unitId);
|
|
1827
1830
|
const scene = renderObject === null || renderObject === void 0 ? void 0 : renderObject.scene;
|
|
@@ -1957,12 +1960,12 @@ const DocDrawingPosition = (props) => {
|
|
|
1957
1960
|
const focusDrawings = drawingManagerService.getFocusDrawings();
|
|
1958
1961
|
if (focusDrawings.length === 0) return;
|
|
1959
1962
|
const { drawingId, unitId } = focusDrawings[0];
|
|
1960
|
-
const documentDataModel = univerInstanceService.
|
|
1961
|
-
const skeleton = (_renderManagerService3 = renderManagerService.
|
|
1962
|
-
const docSelectionRenderService = (_renderManagerService4 = renderManagerService.
|
|
1963
|
+
const documentDataModel = univerInstanceService.getUnit(unitId, UniverInstanceType.UNIVER_DOC);
|
|
1964
|
+
const skeleton = (_renderManagerService3 = renderManagerService.getRenderUnitById(unitId)) === null || _renderManagerService3 === void 0 ? void 0 : _renderManagerService3.with(DocSkeletonManagerService).getSkeleton();
|
|
1965
|
+
const docSelectionRenderService = (_renderManagerService4 = renderManagerService.getRenderUnitById(unitId)) === null || _renderManagerService4 === void 0 ? void 0 : _renderManagerService4.with(DocSelectionRenderService);
|
|
1963
1966
|
const segmentId = docSelectionRenderService === null || docSelectionRenderService === void 0 ? void 0 : docSelectionRenderService.getSegment();
|
|
1964
1967
|
const segmentPage = docSelectionRenderService === null || docSelectionRenderService === void 0 ? void 0 : docSelectionRenderService.getSegmentPage();
|
|
1965
|
-
const drawing = documentDataModel === null || documentDataModel === void 0 || (_documentDataModel$ge = documentDataModel.getSelfOrHeaderFooterModel(segmentId).getBody()) === null || _documentDataModel$ge === void 0 || (_documentDataModel$ge = _documentDataModel$ge.customBlocks) === null || _documentDataModel$ge === void 0 ? void 0 : _documentDataModel$ge.find((c) => c.blockId === drawingId);
|
|
1968
|
+
const drawing = documentDataModel === null || documentDataModel === void 0 || (_documentDataModel$ge = documentDataModel.getSelfOrHeaderFooterModel(segmentId)) === null || _documentDataModel$ge === void 0 || (_documentDataModel$ge = _documentDataModel$ge.getBody()) === null || _documentDataModel$ge === void 0 || (_documentDataModel$ge = _documentDataModel$ge.customBlocks) === null || _documentDataModel$ge === void 0 ? void 0 : _documentDataModel$ge.find((c) => c.blockId === drawingId);
|
|
1966
1969
|
if (drawing == null || skeleton == null || docSelectionRenderService == null) return;
|
|
1967
1970
|
const { startIndex } = drawing;
|
|
1968
1971
|
const glyph = skeleton.findNodeByCharIndex(startIndex, segmentId, segmentPage);
|
|
@@ -2107,8 +2110,8 @@ const DocDrawingTextWrap = (props) => {
|
|
|
2107
2110
|
const drawingParam = drawings[0];
|
|
2108
2111
|
if (drawingParam == null) return null;
|
|
2109
2112
|
const { unitId } = drawingParam;
|
|
2110
|
-
const documentDataModel = univerInstanceService.
|
|
2111
|
-
const renderObject = renderManagerService.
|
|
2113
|
+
const documentDataModel = univerInstanceService.getUnit(unitId, UniverInstanceType.UNIVER_DOC);
|
|
2114
|
+
const renderObject = renderManagerService.getRenderUnitById(unitId);
|
|
2112
2115
|
if ((renderObject === null || renderObject === void 0 ? void 0 : renderObject.scene) == null) return null;
|
|
2113
2116
|
const [disableWrapText, setDisableWrapText] = useState(true);
|
|
2114
2117
|
const [disableDistTB, setDisableDistTB] = useState(true);
|
|
@@ -2479,10 +2482,10 @@ let DocDrawingAddRemoveController = class DocDrawingAddRemoveController extends
|
|
|
2479
2482
|
this.disposeWithMe(this._commandService.onCommandExecuted((command) => {
|
|
2480
2483
|
var _this$_univerInstance;
|
|
2481
2484
|
if (command.id !== UndoCommand.id && command.id !== RedoCommand.id) return;
|
|
2482
|
-
const unitId = (_this$_univerInstance = this._univerInstanceService.
|
|
2485
|
+
const unitId = (_this$_univerInstance = this._univerInstanceService.getCurrentUnitOfType(UniverInstanceType.UNIVER_DOC)) === null || _this$_univerInstance === void 0 ? void 0 : _this$_univerInstance.getUnitId();
|
|
2483
2486
|
const focusedDrawings = this._drawingManagerService.getFocusDrawings();
|
|
2484
2487
|
if (unitId == null || focusedDrawings.length === 0) return;
|
|
2485
|
-
const renderObject = this._renderManagerService.
|
|
2488
|
+
const renderObject = this._renderManagerService.getRenderUnitById(unitId);
|
|
2486
2489
|
const scene = renderObject === null || renderObject === void 0 ? void 0 : renderObject.scene;
|
|
2487
2490
|
if (scene == null) return false;
|
|
2488
2491
|
scene.getTransformerByCreate().refreshControls();
|
|
@@ -2513,7 +2516,7 @@ let DocDrawingAddRemoveController = class DocDrawingAddRemoveController extends
|
|
|
2513
2516
|
docDrawingService.removeNotification(objects);
|
|
2514
2517
|
}
|
|
2515
2518
|
_updateDrawingsOrder(unitId) {
|
|
2516
|
-
const documentDataModel = this._univerInstanceService.
|
|
2519
|
+
const documentDataModel = this._univerInstanceService.getUnit(unitId, UniverInstanceType.UNIVER_DOC);
|
|
2517
2520
|
if (documentDataModel == null) return;
|
|
2518
2521
|
const { drawings, drawingsOrder } = documentDataModel.getSnapshot();
|
|
2519
2522
|
if (drawingsOrder == null) return;
|
|
@@ -3029,7 +3032,7 @@ let DocDrawingTransformerController = class DocDrawingTransformerController exte
|
|
|
3029
3032
|
const { oKey, width, height, left, top, angle } = object;
|
|
3030
3033
|
const drawing = this._drawingManagerService.getDrawingOKey(oKey);
|
|
3031
3034
|
if (drawing == null) continue;
|
|
3032
|
-
const documentDataModel = this._univerInstanceService.
|
|
3035
|
+
const documentDataModel = this._univerInstanceService.getUnit(drawing.unitId, UniverInstanceType.UNIVER_DOC);
|
|
3033
3036
|
const drawingData = documentDataModel === null || documentDataModel === void 0 || (_documentDataModel$ge = documentDataModel.getSnapshot().drawings) === null || _documentDataModel$ge === void 0 ? void 0 : _documentDataModel$ge[drawing.drawingId];
|
|
3034
3037
|
if ((drawingData === null || drawingData === void 0 ? void 0 : drawingData.layoutType) === PositionedObjectLayoutType.INLINE) try {
|
|
3035
3038
|
object.setOpacity(.2);
|