Skip to content

Commit 143fc22

Browse files
authored
Merge pull request #36 from modxcms/add-parameters
1.1.1-pl
2 parents 0b6bda6 + c2a7a0a commit 143fc22

File tree

8 files changed

+40
-14
lines changed

8 files changed

+40
-14
lines changed

.nvmrc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
14

_build/assets/js/Plugins/modxlink/Data.js

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,8 @@ export default class Data {
1414
page: {
1515
page: '',
1616
url: '',
17-
anchor: ''
17+
anchor: '',
18+
parameters: ''
1819
},
1920
url: {
2021
url: ''
@@ -94,9 +95,11 @@ export default class Data {
9495
if (linkType === 'page') {
9596
data.page.page = this.element.getAttribute('data-fred-link-page');
9697
data.page.anchor = this.element.getAttribute('data-fred-link-anchor');
97-
98-
if (data.page.page || data.page.anchor) {
98+
data.page.parameters = this.element.getAttribute('data-fred-link-parameters');
99+
100+
if (data.page.page || data.page.anchor || data.page.parameters) {
99101
data.page.url = url.replace(('#' + data.page.anchor), '');
102+
data.page.url = data.page.url.replace(('?' + data.page.parameters), '');
100103

101104
return {
102105
tab: 'page',
@@ -184,4 +187,4 @@ export default class Data {
184187
}
185188
};
186189
}
187-
}
190+
}

_build/assets/js/Plugins/modxlink/Link.js

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -51,18 +51,21 @@ export default class Link {
5151
}
5252

5353
savePage(data) {
54-
if (!data.page.page && !data.page.anchor) return;
54+
if (!data.page.page && !data.page.anchor && !data.page.parameters) return;
5555

5656
const attributes = {
5757
...(Link.getGeneralAttributes(data, 'page')),
5858
'data-fred-link-page': data.page.page
5959
};
60+
attributes.href = data.page.url;
6061

6162
if (data.page.anchor) {
6263
attributes['data-fred-link-anchor'] = data.page.anchor;
6364
attributes.href = `${data.page.url}#${data.page.anchor}`;
64-
} else {
65-
attributes.href = data.page.url;
65+
}
66+
if (data.page.parameters) {
67+
attributes['data-fred-link-parameters'] = data.page.parameters;
68+
attributes.href = `${attributes.href}?${data.page.parameters}`;
6669
}
6770

6871
return this.handleLink(data.link_text, attributes);
@@ -140,4 +143,4 @@ export default class Link {
140143

141144
this.editor.selection.collapse(false);
142145
}
143-
}
146+
}

_build/assets/js/Plugins/modxlink/modxlink.js

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,16 @@ export default (fred, pluginTools) => {
5555
onkeyup() {
5656
data.page.anchor = this.value();
5757
}
58+
},
59+
{
60+
type: 'textbox',
61+
label: fredConfig.lng('fredrtetinymce.parameters'),
62+
id: 'page_parameters',
63+
value: data.page.parameters,
64+
size: formsize,
65+
onkeyup() {
66+
data.page.parameters = this.value();
67+
}
5868
}
5969
]
6070
},
@@ -201,9 +211,9 @@ export default (fred, pluginTools) => {
201211
}
202212
}
203213
),
204-
onchange() {
214+
onselect() {
205215
data.classes = this.value();
206-
}
216+
},
207217
});
208218
}else{
209219
linkOptions.push({

_build/config.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"lowCaseName": "fredrtetinymce",
44
"description": "",
55
"author": "John Peca",
6-
"version": "1.1.0-pl",
6+
"version": "1.1.1-pl",
77
"package": {
88
"menus": [],
99
"elements": {

assets/components/fredrtetinymce/web/fredrtetinymce.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

core/components/fredrtetinymce/docs/changelog.txt

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,19 @@
11
Changelog for FredRTETinyMCE.
22

3+
1.1.1-pl
4+
==============
5+
6+
Update the modxlink plugin:
7+
- Add support for get parameters in modx links
8+
- Fix class list selection
9+
Update package dependencies
10+
311
1.1.0-pl
412
==============
513

614
Update the modxlink plugin:
715
- Now works with images
8-
- Now supports link_class_list
16+
- Now supports link_class_list
917
- Now works in contextmenu and insert_toolbar
1018
Update package dependencies
1119

core/components/fredrtetinymce/lexicon/en/default.inc.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,4 +19,5 @@
1919
$_lang['fredrtetinymce.classes'] = 'Classes';
2020
$_lang['fredrtetinymce.new_window'] = 'New Window';
2121
$_lang['fredrtetinymce.page_title'] = 'Page Title';
22-
$_lang['fredrtetinymce.tooltip'] = 'Insert/Edit Link';
22+
$_lang['fredrtetinymce.tooltip'] = 'Insert/Edit Link';
23+
$_lang['fredrtetinymce.parameters'] = 'Extra Params';

0 commit comments

Comments
 (0)