Skip to content

Commit 2daa162

Browse files
Merge branch 'develop' of https://github.com/hcengineering/platform into staging-new
Signed-off-by: Artem Savchenko <[email protected]>
2 parents 0f7e534 + 43098b3 commit 2daa162

File tree

14 files changed

+85
-44
lines changed

14 files changed

+85
-44
lines changed

common/config/rush/pnpm-lock.yaml

Lines changed: 3 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/theme/styles/prose.scss

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ table.proseTable {
2323
--table-handle-size: 0.875rem;
2424
--table-handle-indent: calc(var(--table-handle-size) * -1 - 1px);
2525
--table-handle-col-indent: calc(var(--table-handle-size) * -0.5);
26-
--table-handle-row-indent: calc(var(--table-handle-size) * -1 - 0.75rem);
26+
--table-handle-row-indent: calc(var(--table-handle-size) * -1);
2727
--table-insert-marker-indent: calc(-1.25rem - 1px);
2828

2929
--table-selection-z-index: 100;

plugins/text-editor-resources/src/components/CollaborativeTextEditor.svelte

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -423,7 +423,7 @@
423423
editor = new Editor({
424424
extensions: [kit],
425425
element,
426-
editable: false,
426+
editable: !readonly,
427427
editorProps: {
428428
attributes: mergeAttributes(defaultEditorAttributes, editorAttributes, { class: 'flex-grow' })
429429
},

plugins/text-editor-resources/src/components/extension/table/TableNodeView.svelte

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,7 @@
195195
&__col {
196196
right: calc(var(--table-offscreen-spacing) - 1.5rem);
197197
top: 0;
198-
bottom: 0;
198+
bottom: 1rem;
199199
margin: 1.5rem 0;
200200
201201
.table-button {
@@ -204,7 +204,7 @@
204204
}
205205
206206
&__row {
207-
bottom: -0.25rem;
207+
bottom: 1rem;
208208
left: var(--table-offscreen-spacing);
209209
right: var(--table-offscreen-spacing);
210210

plugins/text-editor-resources/src/components/extension/table/decorations/columnHandlerDecoration.ts

Lines changed: 17 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -194,7 +194,24 @@ class ColumnHandler {
194194
const dropMarker = getDropMarker()
195195
const dragMarker = getColDragMarker()
196196

197+
const handleMove = (event: MouseEvent): void => {
198+
if (dropMarker !== null && dragMarker !== null) {
199+
const currentLeft = startLeft + event.clientX - startX
200+
dropIndex = calculateColumnDropIndex(col, columns, currentLeft)
201+
202+
const dragMarkerWidthPx = columns[col].widthPx
203+
const dragMarkerLeftPx = Math.max(0, Math.min(currentLeft, tableWidthPx - dragMarkerWidthPx))
204+
const dropMarkerLeftPx =
205+
dropIndex <= col ? columns[dropIndex].leftPx : columns[dropIndex].leftPx + columns[dropIndex].widthPx
206+
207+
updateColDropMarker(dropMarker, dropMarkerLeftPx - Math.floor(dropMarkerWidthPx / 2) - 1, dropMarkerWidthPx)
208+
updateColDragMarker(dragMarker, dragMarkerLeftPx, dragMarkerWidthPx)
209+
}
210+
}
211+
197212
const handleFinish = (): void => {
213+
window.removeEventListener('mousemove', handleMove)
214+
198215
if (dropMarker !== null) hideDropMarker(dropMarker)
199216
if (dragMarker !== null) hideDragMarker(dragMarker)
200217

@@ -211,21 +228,6 @@ class ColumnHandler {
211228
}
212229
}
213230

214-
const handleMove = (event: MouseEvent): void => {
215-
if (dropMarker !== null && dragMarker !== null) {
216-
const currentLeft = startLeft + event.clientX - startX
217-
dropIndex = calculateColumnDropIndex(col, columns, currentLeft)
218-
219-
const dragMarkerWidthPx = columns[col].widthPx
220-
const dragMarkerLeftPx = Math.max(0, Math.min(currentLeft, tableWidthPx - dragMarkerWidthPx))
221-
const dropMarkerLeftPx =
222-
dropIndex <= col ? columns[dropIndex].leftPx : columns[dropIndex].leftPx + columns[dropIndex].widthPx
223-
224-
updateColDropMarker(dropMarker, dropMarkerLeftPx - Math.floor(dropMarkerWidthPx / 2) - 1, dropMarkerWidthPx)
225-
updateColDragMarker(dragMarker, dragMarkerLeftPx, dragMarkerWidthPx)
226-
}
227-
}
228-
229231
window.addEventListener('mouseup', handleFinish, { once: true })
230232
window.addEventListener('mousemove', handleMove)
231233
})

plugins/text-editor-resources/src/components/extension/table/decorations/rowHandlerDecoration.ts

Lines changed: 17 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -194,7 +194,24 @@ class RowHandler {
194194
const dropMarker = getDropMarker()
195195
const dragMarker = getRowDragMarker()
196196

197+
const handleMove = (event: MouseEvent): void => {
198+
if (dropMarker !== null && dragMarker !== null) {
199+
const cursorTop = startTop + event.clientY - startY
200+
dropIndex = calculateRowDropIndex(row, rows, cursorTop)
201+
202+
const dragMarkerHeightPx = rows[row].heightPx
203+
const dragMarkerTopPx = Math.max(0, Math.min(cursorTop, tableHeightPx - dragMarkerHeightPx))
204+
const dropMarkerTopPx =
205+
dropIndex <= row ? rows[dropIndex].topPx : rows[dropIndex].topPx + rows[dropIndex].heightPx
206+
207+
updateRowDropMarker(dropMarker, dropMarkerTopPx - dropMarkerWidthPx / 2, dropMarkerWidthPx)
208+
updateRowDragMarker(dragMarker, dragMarkerTopPx, dragMarkerHeightPx)
209+
}
210+
}
211+
197212
const handleFinish = (): void => {
213+
window.removeEventListener('mousemove', handleMove)
214+
198215
if (dropMarker !== null) hideDropMarker(dropMarker)
199216
if (dragMarker !== null) hideDragMarker(dragMarker)
200217

@@ -211,21 +228,6 @@ class RowHandler {
211228
}
212229
}
213230

214-
const handleMove = (event: MouseEvent): void => {
215-
if (dropMarker !== null && dragMarker !== null) {
216-
const cursorTop = startTop + event.clientY - startY
217-
dropIndex = calculateRowDropIndex(row, rows, cursorTop)
218-
219-
const dragMarkerHeightPx = rows[row].heightPx
220-
const dragMarkerTopPx = Math.max(0, Math.min(cursorTop, tableHeightPx - dragMarkerHeightPx))
221-
const dropMarkerTopPx =
222-
dropIndex <= row ? rows[dropIndex].topPx : rows[dropIndex].topPx + rows[dropIndex].heightPx
223-
224-
updateRowDropMarker(dropMarker, dropMarkerTopPx - dropMarkerWidthPx / 2, dropMarkerWidthPx)
225-
updateRowDragMarker(dragMarker, dragMarkerTopPx, dragMarkerHeightPx)
226-
}
227-
}
228-
229231
window.addEventListener('mouseup', handleFinish, { once: true })
230232
window.addEventListener('mousemove', handleMove)
231233
})

plugins/view-resources/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@
6161
"@hcengineering/query": "^0.7.17",
6262
"@hcengineering/emoji": "workspace:^0.7.0",
6363
"@hcengineering/theme": "workspace:^0.7.0",
64+
"@hcengineering/workbench": "workspace:^0.7.0",
6465
"@hcengineering/hls": "workspace:^0.7.0",
6566
"fast-equals": "^5.2.2"
6667
}

plugins/view-resources/src/actionImpl.ts

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ import {
1919
copyTextToClipboardOldBrowser,
2020
getClient,
2121
getMarkup,
22+
hasResource,
2223
updateAttribute
2324
} from '@hcengineering/presentation'
2425
import { markupToJSON } from '@hcengineering/text'
@@ -48,6 +49,7 @@ import {
4849
selectionStore
4950
} from './selection'
5051
import { deleteObjects, getObjectId, getObjectLinkFragment, restrictionStore } from './utils'
52+
import workbenchPlugin from '@hcengineering/workbench'
5153

5254
/**
5355
* Action to be used for copying text to clipboard.
@@ -328,8 +330,13 @@ async function OpenInNewTab (
328330
const panelComponent = hierarchy.classHierarchyMixin(d._class, view.mixin.ObjectPanel)
329331
const component = props?.component ?? panelComponent?.component ?? view.component.EditDoc
330332
const loc = await getObjectLinkFragment(hierarchy, d, {}, component)
331-
const url = locationToUrl(loc)
332-
window.open(url, '_blank')
333+
if (hasResource(workbenchPlugin.function.OpenInNewTab) === true) {
334+
const res = await getResource(workbenchPlugin.function.OpenInNewTab)
335+
await res(loc)
336+
} else {
337+
const url = locationToUrl(loc)
338+
window.open(url, '_blank')
339+
}
333340
}
334341

335342
/**

plugins/workbench-resources/src/connect.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -453,7 +453,7 @@ export async function connect (title: string): Promise<Client | undefined> {
453453
const hasEmail = (si: SocialId): boolean => {
454454
return [SocialIdType.EMAIL, SocialIdType.GOOGLE, SocialIdType.GITHUB].some((type) => type === si.type)
455455
}
456-
const email = me.fullSocialIds.find((si) => hasEmail(si))?.key
456+
const email = me.fullSocialIds.find((si) => hasEmail(si) && si.isDeleted !== true)?.key
457457
const socialId = me.fullSocialIds.find((si) => si._id === me.primarySocialId)?.key
458458

459459
const data: Record<string, any> = {

plugins/workbench-resources/src/index.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ import Workbench from './components/Workbench.svelte'
2525
import ServerManager from './components/ServerManager.svelte'
2626
import WorkbenchTabs from './components/WorkbenchTabs.svelte'
2727
import { isAdminUser } from '@hcengineering/presentation'
28-
import { canCloseTab, closeCurrentTab, closeTab, pinTab, unpinTab } from './workbench'
28+
import { canCloseTab, closeCurrentTab, closeTab, OpenInNewTab, pinTab, unpinTab } from './workbench'
2929
import { closeWidget, closeWidgetTab, createWidgetTab, getSidebarObject } from './sidebar'
3030

3131
async function hasArchiveSpaces (spaces: Space[]): Promise<boolean> {
@@ -66,7 +66,8 @@ export default async (): Promise<Resources> => ({
6666
CloseWidget: closeWidget,
6767
GetSidebarObject: getSidebarObject,
6868
LogIn: logIn,
69-
LogOut: logOut
69+
LogOut: logOut,
70+
OpenInNewTab
7071
},
7172
actionImpl: {
7273
Navigate: doNavigate,

0 commit comments

Comments
 (0)