Skip to content

Commit b738790

Browse files
widgetbay, add forceLink
1 parent b3fcea7 commit b738790

File tree

2 files changed

+10
-4
lines changed

2 files changed

+10
-4
lines changed

src/shortcodeList.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ tinymce.PluginManager.add('shortcodeList', function (editor, url) {
3434
},
3535
{
3636
title: 'Widgetbay',
37-
code: '[widgetbay id="optional" link="optional"]',
37+
code: '[widgetbay id="optional" link="optional" forceLink="optional"]',
3838
description: 'Insert a widgetbay iframe. You can use the id or the link, but not both. You can use multiple links separated by a comma. - link="https://link1.com,https://link2.com'
3939
},
4040
{

src/widgetbay.js

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,13 +26,18 @@ tinymce.PluginManager.add('widgetbay', function (editor, url) {
2626
</div>
2727
2828
</label>
29-
30-
29+
3130
<label>
3231
<span class="label-span">Custom title (optional)</span>
3332
<input type="text" name="widget-title" style="border: 2px solid #eeeeee; padding: 7px 10px; border-radius: 5px;">
3433
</label>
3534
35+
<label>
36+
<span class="label-span">Force Link (optional)</span>
37+
<input type="text" name="widget-force-link" style="border: 2px solid #eeeeee; padding: 7px 10px; border-radius: 5px;">
38+
<p style="color: #9f9f9f; font-size: 0.8rem;">It only works on single product</p>
39+
</label>
40+
3641
<button type="submit" style="padding: 10px; border-radius: .2rem; cursor: pointer; background-color: rgb(14,165,233); color: white;">
3742
Create
3843
</button>
@@ -133,8 +138,9 @@ function generateShortcode () {
133138
const parsedTitle = formData.get('widget-title') ? 'title="' + formData.get('widget-title') + '" ' : ''
134139
const parsedLink = link ? 'link="' + link + '" ' : ' '
135140
const parsedId = formData.get('widget-id') ? 'id="' + formData.get('widget-id') + '"' : ' '
141+
const parsedForceLink = formData.get('widget-force-link') ? 'forceLink="' + formData.get('widget-force-link') + '" ' : ' '
136142

137-
const content = '[widgetbay ' + parsedId + parsedLink + parsedTitle + ']'
143+
const content = '[widgetbay ' + parsedId + parsedLink + parsedTitle + parsedForceLink + ']'
138144

139145
tinymce.activeEditor.insertContent(content)
140146
tinymce.activeEditor.windowManager.close()

0 commit comments

Comments
 (0)