diff --git a/Configuration/Settings.yaml b/Configuration/Settings.yaml index 542e741..b1153bf 100644 --- a/Configuration/Settings.yaml +++ b/Configuration/Settings.yaml @@ -1,11 +1,13 @@ -TYPO3: +Neos: Neos: - typoScript: + fusion: autoInclude: Flownative.Anchorlinks: true userInterface: translation: autoInclude: - 'Flownative.Anchorlinks': ['Main', 'NodeTypes/*'] + Flownative.Anchorlinks: + - Main + - 'NodeTypes/*' requireJsPathMapping: - 'Flownative.Anchorlinks/Views': 'resource://Flownative.Anchorlinks/Public/JavaScript/Inspector/Views' + Flownative.Anchorlinks/Views: 'resource://Flownative.Anchorlinks/Public/JavaScript/Inspector/Views' diff --git a/README.md b/README.md index 4e5244d..58ee07a 100644 --- a/README.md +++ b/README.md @@ -5,33 +5,33 @@ Create anchor links to any content element on the page. ## Setup ``` -composer require 'flownative/anchorlinks:@dev' +composer require 'flownative/anchorlinks' ``` -Add `Flownative.Anchorlinks:AnchorMixin` mixin to any nodetype that you would want to link to. +Add the `Flownative.Anchorlinks:AnchorMixin` mixin to any nodetype that you would want to link to. E.g. this code will add such ability to every Content nodetype: -``` -'TYPO3.Neos:Content': +```yaml +'Neos.Neos:Content': superTypes: 'Flownative.Anchorlinks:AnchorMixin': true ``` -Add `Flownative.Anchorlinks:AnchorWrapper` processor to the same nodetype renderer to insert anchor tag with given id before it. +Add the `Flownative.Anchorlinks:AnchorWrapper` processor to the same nodetype renderer to insert an anchor tag with the given id before it. E.g.: ``` -prototype(TYPO3.Neos:Content) { - @process.appendAnchor = Flownative.Anchorlinks:AnchorWrapper +prototype(Neos.Neos:Content) { + @process.prependAnchor = Flownative.Anchorlinks:AnchorWrapper } ``` ## Usage -Choose some content node that you would like to link to, and fill in `sectionId` inspector property. +Choose some content node that you would like to link to, and fill in the `sectionId` property in the inspector. -After that you would see a button appear below to copy link to this node to clipboard. +After that you will see a button appear below the field to copy the link to this node to the clipboard. -When you click that button, the link to the given node will be copied to the clipboard. Paste it in insert link field in Aloha editor and you are done! +When you click that button, the link to the given node will be copied to the clipboard. Paste it in the "insert link" field in Aloha editor and you are done! diff --git a/Resources/Private/Fusion/Root.fusion b/Resources/Private/Fusion/Root.fusion new file mode 100644 index 0000000..8ddb023 --- /dev/null +++ b/Resources/Private/Fusion/Root.fusion @@ -0,0 +1,7 @@ +# Meant to be used as a processor. Prepends a tag with the sectionId +prototype(Flownative.Anchorlinks:AnchorWrapper) < prototype(Neos.Fusion:Value) { + anchor = Neos.Fusion:Tag { + attributes.id = ${q(node).property('sectionId')} + } + value = ${q(node).property('sectionId') ? this.anchor + value : value} +} diff --git a/Resources/Private/TypoScript/Root.ts2 b/Resources/Private/TypoScript/Root.ts2 deleted file mode 100644 index 4c4c4fd..0000000 --- a/Resources/Private/TypoScript/Root.ts2 +++ /dev/null @@ -1,7 +0,0 @@ -# Meant to be used as a processor. Would prepend a tag with the sectionId -prototype(Flownative.Anchorlinks:AnchorWrapper) < prototype(TYPO3.TypoScript:Value) { - anchor = TYPO3.TypoScript:Tag { - attributes.id = ${q(node).property('sectionId')} - } - value = ${q(node).property('sectionId') ? this.anchor + value : value} -} diff --git a/Resources/Public/JavaScript/Inspector/Views/AnchorView.js b/Resources/Public/JavaScript/Inspector/Views/AnchorView.js index 7218234..8631485 100644 --- a/Resources/Public/JavaScript/Inspector/Views/AnchorView.js +++ b/Resources/Public/JavaScript/Inspector/Views/AnchorView.js @@ -1,32 +1,32 @@ define([ - 'emberjs', - 'text!./AnchorView.html', - 'Shared/I18n' + 'emberjs', + 'text!./AnchorView.html', + 'Shared/I18n' ], function( - Ember, - template, - I18n + Ember, + template, + I18n ) { - return Ember.View.extend({ - template: Ember.Handlebars.compile(template), - buttonLabel: 'copy', - _buttonLabel: function() { - return I18n.translate('Flownative.Anchorlinks:Main:' + this.get('buttonLabel'), 'Copy link'); - }.property('buttonLabel'), - _showButton: function() { - return this.get('inspector.nodeProperties.sectionId') ? true : false; - }.property('inspector.nodeProperties.sectionId'), - copyToClipboard: function () { - var documentNodeIdentifier = document.getElementById('neos-document-metadata').dataset['node-_identifier']; - var link = 'node://' + documentNodeIdentifier + '#' + this.get('inspector.nodeProperties.sectionId'); - var textArea = document.createElement('textarea'); - textArea.innerText = link; - document.body.appendChild(textArea); - textArea.select(); - document.execCommand('copy'); - textArea.parentNode.removeChild(textArea); - this.set('buttonLabel', 'copied'); - } - }); + return Ember.View.extend({ + template: Ember.Handlebars.compile(template), + buttonLabel: 'copy', + _buttonLabel: function() { + return I18n.translate('Flownative.Anchorlinks:Main:' + this.get('buttonLabel'), 'Copy link'); + }.property('buttonLabel'), + _showButton: function() { + return !!this.get('inspector.nodeProperties.sectionId'); + }.property('inspector.nodeProperties.sectionId'), + copyToClipboard: function () { + var documentNodeIdentifier = document.getElementById('neos-document-metadata').dataset['node-_identifier']; + var link = 'node://' + documentNodeIdentifier + '#' + this.get('inspector.nodeProperties.sectionId'); + var textArea = document.createElement('textarea'); + textArea.innerText = link; + document.body.appendChild(textArea); + textArea.select(); + document.execCommand('copy'); + textArea.parentNode.removeChild(textArea); + this.set('buttonLabel', 'copied'); + } + }); }); diff --git a/composer.json b/composer.json index 3432478..5b4efbd 100644 --- a/composer.json +++ b/composer.json @@ -4,16 +4,84 @@ "name": "flownative/anchorlinks", "license": "LGPL-3.0+", "require": { - "typo3/neos": "*" + "neos/fluid-adaptor": "^4.0", + "neos/fusion": "^3.0", + "neos/neos": "^3.0" }, "autoload": { - "psr-0": { - "Flownative\\Anchorlinks": "Classes/" + "psr-4": { + "Flownative\\Anchorlinks\\": "Classes/" } }, "extra": { "neos": { "package-key": "Flownative.Anchorlinks" - } + }, + "applied-flow-migrations": [ + "TYPO3.FLOW3-201201261636", + "TYPO3.Fluid-201205031303", + "TYPO3.FLOW3-201205292145", + "TYPO3.FLOW3-201206271128", + "TYPO3.FLOW3-201209201112", + "TYPO3.Flow-201209251426", + "TYPO3.Flow-201211151101", + "TYPO3.Flow-201212051340", + "TYPO3.TypoScript-130516234520", + "TYPO3.TypoScript-130516235550", + "TYPO3.TYPO3CR-130523180140", + "TYPO3.Neos.NodeTypes-201309111655", + "TYPO3.Flow-201310031523", + "TYPO3.Flow-201405111147", + "TYPO3.Neos-201407061038", + "TYPO3.Neos-201409071922", + "TYPO3.TYPO3CR-140911160326", + "TYPO3.Neos-201410010000", + "TYPO3.TYPO3CR-141101082142", + "TYPO3.Neos-20141113115300", + "TYPO3.Fluid-20141113120800", + "TYPO3.Flow-20141113121400", + "TYPO3.Fluid-20141121091700", + "TYPO3.Neos-20141218134700", + "TYPO3.Fluid-20150214130800", + "TYPO3.Neos-20150303231600", + "TYPO3.TYPO3CR-20150510103823", + "TYPO3.Flow-20151113161300", + "TYPO3.Form-20160601101500", + "TYPO3.Flow-20161115140400", + "TYPO3.Flow-20161115140430", + "Neos.Flow-20161124204700", + "Neos.Flow-20161124204701", + "Neos.Twitter.Bootstrap-20161124204912", + "Neos.Form-20161124205254", + "Neos.Flow-20161124224015", + "Neos.Party-20161124225257", + "Neos.Eel-20161124230101", + "Neos.Setup-20161124230842", + "Neos.Imagine-20161124231742", + "Neos.Media-20161124233100", + "Neos.NodeTypes-20161125002300", + "Neos.Neos-20161125002322", + "Neos.ContentRepository-20161125012000", + "Neos.Fusion-20161125013710", + "Neos.Setup-20161125014759", + "Neos.Fusion-20161125104701", + "Neos.NodeTypes-20161125104800", + "Neos.Neos-20161125104802", + "Neos.Neos-20161125122412", + "Neos.Flow-20161125124112", + "Neos.SwiftMailer-20161130105617", + "TYPO3.FluidAdaptor-20161130112935", + "Neos.Fusion-20161201202543", + "Neos.Neos-20161201222211", + "Neos.Fusion-20161202215034", + "Neos.Fusion-20161219092345", + "Neos.ContentRepository-20161219093512", + "Neos.Media-20161219094126", + "Neos.Neos-20161219094403", + "Neos.Neos-20161219122512", + "Neos.Fusion-20161219130100", + "Neos.Neos-20161220163741", + "Neos.Fusion-20170120013047" + ] } }