Skip to content

Commit

Permalink
Merge pull request #36 from modxcms/add-parameters
Browse files Browse the repository at this point in the history
1.1.1-pl
  • Loading branch information
matdave authored Jan 24, 2024
2 parents 0b6bda6 + c2a7a0a commit 143fc22
Show file tree
Hide file tree
Showing 8 changed files with 40 additions and 14 deletions.
1 change: 1 addition & 0 deletions .nvmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
14
11 changes: 7 additions & 4 deletions _build/assets/js/Plugins/modxlink/Data.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@ export default class Data {
page: {
page: '',
url: '',
anchor: ''
anchor: '',
parameters: ''
},
url: {
url: ''
Expand Down Expand Up @@ -94,9 +95,11 @@ export default class Data {
if (linkType === 'page') {
data.page.page = this.element.getAttribute('data-fred-link-page');
data.page.anchor = this.element.getAttribute('data-fred-link-anchor');

if (data.page.page || data.page.anchor) {
data.page.parameters = this.element.getAttribute('data-fred-link-parameters');

if (data.page.page || data.page.anchor || data.page.parameters) {
data.page.url = url.replace(('#' + data.page.anchor), '');
data.page.url = data.page.url.replace(('?' + data.page.parameters), '');

return {
tab: 'page',
Expand Down Expand Up @@ -184,4 +187,4 @@ export default class Data {
}
};
}
}
}
11 changes: 7 additions & 4 deletions _build/assets/js/Plugins/modxlink/Link.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,18 +51,21 @@ export default class Link {
}

savePage(data) {
if (!data.page.page && !data.page.anchor) return;
if (!data.page.page && !data.page.anchor && !data.page.parameters) return;

const attributes = {
...(Link.getGeneralAttributes(data, 'page')),
'data-fred-link-page': data.page.page
};
attributes.href = data.page.url;

if (data.page.anchor) {
attributes['data-fred-link-anchor'] = data.page.anchor;
attributes.href = `${data.page.url}#${data.page.anchor}`;
} else {
attributes.href = data.page.url;
}
if (data.page.parameters) {
attributes['data-fred-link-parameters'] = data.page.parameters;
attributes.href = `${attributes.href}?${data.page.parameters}`;
}

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

this.editor.selection.collapse(false);
}
}
}
14 changes: 12 additions & 2 deletions _build/assets/js/Plugins/modxlink/modxlink.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,16 @@ export default (fred, pluginTools) => {
onkeyup() {
data.page.anchor = this.value();
}
},
{
type: 'textbox',
label: fredConfig.lng('fredrtetinymce.parameters'),
id: 'page_parameters',
value: data.page.parameters,
size: formsize,
onkeyup() {
data.page.parameters = this.value();
}
}
]
},
Expand Down Expand Up @@ -201,9 +211,9 @@ export default (fred, pluginTools) => {
}
}
),
onchange() {
onselect() {
data.classes = this.value();
}
},
});
}else{
linkOptions.push({
Expand Down
2 changes: 1 addition & 1 deletion _build/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"lowCaseName": "fredrtetinymce",
"description": "",
"author": "John Peca",
"version": "1.1.0-pl",
"version": "1.1.1-pl",
"package": {
"menus": [],
"elements": {
Expand Down
2 changes: 1 addition & 1 deletion assets/components/fredrtetinymce/web/fredrtetinymce.min.js

Large diffs are not rendered by default.

10 changes: 9 additions & 1 deletion core/components/fredrtetinymce/docs/changelog.txt
Original file line number Diff line number Diff line change
@@ -1,11 +1,19 @@
Changelog for FredRTETinyMCE.

1.1.1-pl
==============

Update the modxlink plugin:
- Add support for get parameters in modx links
- Fix class list selection
Update package dependencies

1.1.0-pl
==============

Update the modxlink plugin:
- Now works with images
- Now supports link_class_list
- Now supports link_class_list
- Now works in contextmenu and insert_toolbar
Update package dependencies

Expand Down
3 changes: 2 additions & 1 deletion core/components/fredrtetinymce/lexicon/en/default.inc.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,5 @@
$_lang['fredrtetinymce.classes'] = 'Classes';
$_lang['fredrtetinymce.new_window'] = 'New Window';
$_lang['fredrtetinymce.page_title'] = 'Page Title';
$_lang['fredrtetinymce.tooltip'] = 'Insert/Edit Link';
$_lang['fredrtetinymce.tooltip'] = 'Insert/Edit Link';
$_lang['fredrtetinymce.parameters'] = 'Extra Params';

0 comments on commit 143fc22

Please sign in to comment.