Skip to content

Commit

Permalink
Merge branch '4' into 5.1
Browse files Browse the repository at this point in the history
  • Loading branch information
GuySartorelli committed Jan 25, 2024
2 parents 9202ce9 + 9fbb2f3 commit a249efe
Show file tree
Hide file tree
Showing 5 changed files with 33 additions and 31 deletions.
2 changes: 1 addition & 1 deletion client/dist/js/TinyMCE_sslink-anchor.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion client/dist/js/TinyMCE_sslink-internal.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

29 changes: 15 additions & 14 deletions client/src/legacy/TinyMCE_sslink-anchor.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* global tinymce, editorIdentifier, ss */
/* global tinymce, ss */
import i18n from 'i18n';
import TinyMCEActionRegistrar from 'lib/TinyMCEActionRegistrar';
import React from 'react';
Expand All @@ -13,21 +13,22 @@ import { updatedCurrentField } from '../state/anchorSelector/AnchorSelectorActio

const commandName = 'sslinkanchor';

// Link to external url
TinyMCEActionRegistrar
.addAction(
'sslink',
{
text: i18n._t('CMS.LINKLABEL_ANCHOR', 'Anchor on a page'),
onAction: (activeEditor) => activeEditor.execCommand(commandName),
priority: 60,
},
editorIdentifier,
)
.addCommandWithUrlTest(commandName, /^\[sitetree_link.+]#[^#\]]+$/);

const plugin = {
init(editor) {
// Add "Anchor on a page" to link menu for this editor
TinyMCEActionRegistrar
.addAction(
'sslink',
{
text: i18n._t('CMS.LINKLABEL_ANCHOR', 'Anchor on a page'),
onAction: (activeEditor) => activeEditor.execCommand(commandName),
priority: 60,
},
editor.getParam('editorIdentifier'),
)
.addCommandWithUrlTest(commandName, /^\[sitetree_link.+]#[^#\]]+$/);

// Add a command that corresponds with the above menu item
editor.addCommand(commandName, () => {
const field = jQuery(`#${editor.id}`).entwine('ss');
// Get the anchors in the current field and save them as props for AnchorSelectorField
Expand Down
29 changes: 15 additions & 14 deletions client/src/legacy/TinyMCE_sslink-internal.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* global tinymce, editorIdentifier, ss */
/* global tinymce, ss */
import i18n from 'i18n';
import TinyMCEActionRegistrar from 'lib/TinyMCEActionRegistrar';
import React from 'react';
Expand All @@ -12,21 +12,22 @@ import { provideInjector } from 'lib/Injector';

const commandName = 'sslinkinternal';

// Link to external url
TinyMCEActionRegistrar
.addAction(
'sslink',
{
text: i18n._t('CMS.LINKLABEL_PAGE', 'Page on this site'),
onAction: (activeEditor) => activeEditor.execCommand(commandName),
priority: 90,
},
editorIdentifier,
)
.addCommandWithUrlTest(commandName, /^\[sitetree_link.+]$/);

const plugin = {
init(editor) {
// Add "Page on this site" to link menu for this editor
TinyMCEActionRegistrar
.addAction(
'sslink',
{
text: i18n._t('CMS.LINKLABEL_PAGE', 'Page on this site'),
onAction: (activeEditor) => activeEditor.execCommand(commandName),
priority: 90,
},
editor.getParam('editorIdentifier'),
)
.addCommandWithUrlTest(commandName, /^\[sitetree_link.+]$/);

// Add a command that corresponds with the above menu item
editor.addCommand(commandName, () => {
const field = jQuery(`#${editor.id}`).entwine('ss');

Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
],
"require": {
"php": "^8.1",
"silverstripe/admin": "^2",
"silverstripe/admin": "^2.1.11",
"silverstripe/campaign-admin": "^2",
"silverstripe/framework": "^5.1",
"silverstripe/reports": "^5",
Expand Down

0 comments on commit a249efe

Please sign in to comment.