Skip to content

Commit

Permalink
Fix deprecated title usage in NcAppNavigationItem
Browse files Browse the repository at this point in the history
Signed-off-by: Raimund Schlüßler <raimund.schluessler@mailbox.org>
  • Loading branch information
raimund-schluessler committed Jan 29, 2023
1 parent e0fb518 commit 262894f
Showing 1 changed file with 6 additions and 25 deletions.
31 changes: 6 additions & 25 deletions src/components/NcAppNavigationItem/NcAppNavigationItem.vue
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,7 @@ Just set the `pinned` prop.
:aria-expanded="opened.toString()"
:href="href || '#'"
:target="isExternal(href) ? '_blank' : ''"
:title="title || nameTitleFallback"
:title="title || name"
@blur="handleBlur"
@click="onClick"
@focus="handleFocus"
Expand All @@ -238,12 +238,12 @@ Just set the `pinned` prop.
<slot v-else-if="isIconShown" name="icon" />
</div>
<span v-if="!editingActive" class="app-navigation-entry__title">
{{ nameTitleFallback }}
{{ name }}
</span>
<div v-if="editingActive" class="editingContainer">
<NcInputConfirmCancel ref="editingInput"
v-model="editingValue"
:placeholder="editPlaceholder !== '' ? editPlaceholder : nameTitleFallback"
:placeholder="editPlaceholder !== '' ? editPlaceholder : name"
@cancel="cancelEditing"
@confirm="handleEditingDone" />
</div>
Expand All @@ -253,7 +253,7 @@ Just set the `pinned` prop.
<!-- undo entry -->
<div v-if="undo" class="app-navigation-entry__deleted">
<div class="app-navigation-entry__deleted-description">
{{ nameTitleFallback }}
{{ name }}
</div>
</div>

Expand Down Expand Up @@ -344,20 +344,14 @@ export default {
props: {
/**
* The main text content of the entry.
* Previously called `title`, now deprecated
*/
name: {
type: String,
// TODO: Make it required in the next major release (see title prop)
default: '',
required: true,
},

/**
* The title attribute of the element.
*
* ⚠ Using this prop as the main content text is DEPRECATED
* Please use `name` instead. If you were planning to define the
* html element title attribute, this is the proper way.
*/
title: {
type: String,
Expand Down Expand Up @@ -550,17 +544,6 @@ export default {
},

computed: {
/**
* TODO: drop on the 8.0.0 major, see title/name prop
*/
nameTitleFallback() {
if (!this.name) {
console.warn('The `name` prop is required. Please migrate away from the deprecated `title` prop.')
return this.title
}
return this.name
},

collapsible() {
return this.allowCollapse && !!this.$slots.default
},
Expand Down Expand Up @@ -656,7 +639,7 @@ export default {

// Edition methods
handleEdit() {
this.editingValue = this.nameTitleFallback
this.editingValue = this.name
this.editingActive = true
this.onMenuToggle(false)
this.$nextTick(() => {
Expand All @@ -667,8 +650,6 @@ export default {
this.editingActive = false
},
handleEditingDone() {
// @deprecated, please use `name` instead
this.$emit('update:title', this.editingValue)
this.$emit('update:name', this.editingValue)
this.editingValue = ''
this.editingActive = false
Expand Down

0 comments on commit 262894f

Please sign in to comment.