Skip to content

Commit

Permalink
chore: Move to NcButton and add aria-label
Browse files Browse the repository at this point in the history
Signed-off-by: Julius Knorr <[email protected]>
  • Loading branch information
juliusknorr committed Jan 16, 2025
1 parent 09d787c commit 3f7c343
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 18 deletions.
17 changes: 7 additions & 10 deletions src/components/Editor/SmartPickerMenu.vue
Original file line number Diff line number Diff line change
Expand Up @@ -5,26 +5,23 @@

<template>
<div contenteditable="false" class="smart-picker-menu-container">
<NcActions :title="t('text', 'Open the Smart Picker')" :type="'tertiary'">
<NcActionButton @click="$emit('open-smart-picker')">
<template #icon>
<PlusIcon />
</template>
</NcActionButton>
</NcActions>
<NcButton :aria-label="t('text', 'Open the Smart Picker')" :type="'tertiary'" @click="$emit('open-smart-picker')">
<template #icon>
<PlusIcon />
</template>
</NcButton>
</div>
</template>

<script>
import PlusIcon from 'vue-material-design-icons/Plus.vue'
import { NcActions, NcActionButton } from '@nextcloud/vue'
import { NcButton } from '@nextcloud/vue'

export default {
name: 'SmartPickerMenu',
components: {
PlusIcon,
NcActions,
NcActionButton,
NcButton,
},
}

Expand Down
2 changes: 1 addition & 1 deletion src/plugins/currentLineMenu.js
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ function currentParagraphDecorations(doc, currentParagraph, editor) {
*/
function decorationForCurrentParagraph(currentParagraph, editor) {
return Decoration.widget(
currentParagraph.pos + 1,
currentParagraph?.pos + 1,
menuForCurrentParagraph(editor),
{ side: -1 },
)
Expand Down
14 changes: 7 additions & 7 deletions src/tests/plugins/extractLinkParagraphs.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,15 +23,15 @@ describe('extractLinkParagraphs', () => {
const doc = prepareDoc(content)
const paragraphs = extractLinkParagraphs(doc)
expect(paragraphs).toEqual([
{ offset: 0, type: 'text-only', nodeSize: 6 },
{ pos: 0, type: 'text-only', nodeSize: 6 },
])
})

it('returns paragraphs with a single preview', () => {
const doc = prepareDoc(preview)
const paragraphs = extractLinkParagraphs(doc)
expect(paragraphs).toEqual([
{ offset: 0, type: 'link-preview', nodeSize: 6 },
{ pos: 0, type: 'link-preview', nodeSize: 6 },
])
})

Expand All @@ -40,7 +40,7 @@ describe('extractLinkParagraphs', () => {
const doc = prepareDoc(content)
const paragraphs = extractLinkParagraphs(doc)
expect(paragraphs).toEqual([
{ offset: 0, type: 'text-only', nodeSize: 7 },
{ pos: 0, type: 'text-only', nodeSize: 7 },
])
})

Expand All @@ -50,8 +50,8 @@ describe('extractLinkParagraphs', () => {
const doc = prepareDoc(content)
const paragraphs = extractLinkParagraphs(doc)
expect(paragraphs).toEqual([
{ offset: 0, type: 'text-only', nodeSize: 6 },
{ offset: 6, type: 'text-only', nodeSize: 6 },
{ pos: 0, type: 'text-only', nodeSize: 6 },
{ pos: 6, type: 'text-only', nodeSize: 6 },
])
})

Expand All @@ -60,8 +60,8 @@ describe('extractLinkParagraphs', () => {
const doc = prepareDoc(content)
const paragraphs = extractLinkParagraphs(doc)
expect(paragraphs).toEqual([
{ offset: 0, type: 'text-only', nodeSize: 6 },
{ offset: 6, type: 'link-preview', nodeSize: 6 },
{ pos: 0, type: 'text-only', nodeSize: 6 },
{ pos: 6, type: 'link-preview', nodeSize: 6 },
])
})

Expand Down

0 comments on commit 3f7c343

Please sign in to comment.