Skip to content

Commit

Permalink
Widgetbay button, add custom title
Browse files Browse the repository at this point in the history
  • Loading branch information
Claudio-Emmolo committed Jun 6, 2024
1 parent 158b30e commit c6021d6
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/widgetbay.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,13 @@ tinymce.PluginManager.add('widgetbay', function (editor, url) {
name: 'link',
label: 'or add product URL',
placeholder: 'https://www.amazon.it/B...'
},
{
type: 'input',
inputMode: 'text',
name: 'title',
label: 'Custom title',
placeholder: 'Add custom title to product'
}
]
},
Expand All @@ -38,8 +45,9 @@ tinymce.PluginManager.add('widgetbay', function (editor, url) {

const id = data.id ? 'id="' + data.id + '"' : null
const link = data.link ? 'link="' + data.link + '"' : null
const title = data.title ? 'title="' + data.title + '"' : null

editor.insertContent('[widgetbay ' + (id ?? link) + ']')
editor.insertContent('[widgetbay ' + (id ?? link) + ' ' + (title ?? '') + ']')
api.close()
}
})
Expand Down

0 comments on commit c6021d6

Please sign in to comment.