fix: add document inline editor (#7233)
Some checks are pending
CI / test (push) Blocked by required conditions
CI / uitest (push) Waiting to run
CI / uitest-pg (push) Waiting to run
CI / uitest-qms (push) Waiting to run
CI / docker-build (push) Blocked by required conditions
CI / dist-build (push) Blocked by required conditions
CI / build (push) Waiting to run
CI / svelte-check (push) Blocked by required conditions
CI / formatting (push) Blocked by required conditions

Signed-off-by: Alexander Onnikov <Alexander.Onnikov@xored.com>
This commit is contained in:
Alexander Onnikov 2024-11-27 12:54:04 +07:00 committed by GitHub
parent 27547e580c
commit d9a11e57d2
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 55 additions and 2 deletions

View File

@ -312,6 +312,10 @@ function defineDocument (builder: Builder): void {
component: document.component.DocumentIcon
})
builder.mixin(document.class.Document, core.class.Class, view.mixin.AttributeEditor, {
inlineEditor: document.component.DocumentInlineEditor
})
// Actions
createAction(builder, {

View File

@ -27,6 +27,7 @@ export default mergeIds(documentId, document, {
component: {
Documents: '' as AnyComponent,
DocumentPresenter: '' as AnyComponent,
DocumentInlineEditor: '' as AnyComponent,
NotificationDocumentPresenter: '' as AnyComponent,
TeamspaceSpacePresenter: '' as AnyComponent,
Move: '' as AnyComponent,

View File

@ -0,0 +1,46 @@
<!--
// Copyright © 2022 Hardcore Engineering Inc.
//
// Licensed under the Eclipse Public License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License. You may
// obtain a copy of the License at https://www.eclipse.org/legal/epl-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
//
// See the License for the specific language governing permissions and
// limitations under the License.
-->
<script lang="ts">
import { Document } from '@hcengineering/document'
import { Ref } from '@hcengineering/core'
import { ButtonKind, ButtonSize } from '@hcengineering/ui'
import { ObjectBox } from '@hcengineering/view-resources'
import document from '../plugin'
export let value: Ref<Document> | undefined
export let readonly: boolean = false
export let kind: ButtonKind = 'no-border'
export let size: ButtonSize = 'small'
export let justify: 'left' | 'center' = 'center'
export let width: string | undefined = undefined
export let onChange: (value: any) => void
</script>
<ObjectBox
bind:value
on:change={(e) => {
onChange(e.detail)
}}
_class={document.class.Document}
label={document.string.Document}
searchField={'title'}
docQuery={{}}
{readonly}
{kind}
{size}
{justify}
{width}
/>

View File

@ -32,6 +32,7 @@ import { openDoc } from '@hcengineering/view-resources'
import CreateDocument from './components/CreateDocument.svelte'
import DocumentIcon from './components/DocumentIcon.svelte'
import DocumentItem from './components/DocumentItem.svelte'
import DocumentInlineEditor from './components/DocumentInlineEditor.svelte'
import DocumentPresenter from './components/DocumentPresenter.svelte'
import DocumentSearchIcon from './components/DocumentSearchIcon.svelte'
import DocumentToDoPresenter from './components/DocumentToDoPresenter.svelte'
@ -167,6 +168,7 @@ export default async (): Promise<Resources> => ({
component: {
CreateDocument,
CreateTeamspace,
DocumentInlineEditor,
DocumentPresenter,
Documents,
EditDoc,

View File

@ -27,13 +27,13 @@
LabelAndProps,
getEventPositionElement,
getFocusManager,
showPanel,
showPopup
} from '@hcengineering/ui'
import view from '@hcengineering/view'
import { createEventDispatcher } from 'svelte'
import ObjectBoxPopup from './ObjectBoxPopup.svelte'
import ObjectPresenter from './ObjectPresenter.svelte'
import { openDoc } from '../utils'
export let _class: Ref<Class<Doc>>
export let excluded: Array<Ref<Doc>> | undefined = undefined
@ -181,7 +181,7 @@
size={'small'}
action={() => {
if (selected) {
showPanel(view.component.EditDoc, selected._id, Hierarchy.mixinOrClass(selected), 'content')
void openDoc(client.getHierarchy(), selected)
}
}}
/>