diu / neos-anchorlink
扩展Neos CKE5链接编辑器的自定义锚点链接选项
0.1.0
2020-02-07 12:29 UTC
Requires
- neos/neos-ui: *
- dev-master
- 0.1.0
- dev-dependabot/npm_and_yarn/Resources/Private/AnchorLink/qs-6.11.0
- dev-dependabot/npm_and_yarn/Resources/Private/AnchorLink/decode-uri-component-0.2.2
- dev-dependabot/npm_and_yarn/Resources/Private/AnchorLink/loader-utils-1.4.2
- dev-dependabot/npm_and_yarn/Resources/Private/AnchorLink/terser-4.8.1
- dev-dependabot/npm_and_yarn/Resources/Private/AnchorLink/shell-quote-1.7.3
- dev-dependabot/npm_and_yarn/Resources/Private/AnchorLink/async-2.6.4
- dev-dependabot/npm_and_yarn/Resources/Private/AnchorLink/url-parse-1.5.10
- dev-dependabot/npm_and_yarn/Resources/Private/AnchorLink/ajv-6.12.6
- dev-dependabot/npm_and_yarn/Resources/Private/AnchorLink/mout-1.2.3
- dev-dependabot/npm_and_yarn/Resources/Private/AnchorLink/shelljs-0.8.5
- dev-dependabot/npm_and_yarn/Resources/Private/AnchorLink/path-parse-1.0.7
- dev-dependabot/npm_and_yarn/Resources/Private/AnchorLink/browserslist-4.16.6
- dev-dependabot/npm_and_yarn/Resources/Private/AnchorLink/hosted-git-info-2.8.9
- dev-dependabot/npm_and_yarn/Resources/Private/AnchorLink/lodash-4.17.21
- dev-dependabot/npm_and_yarn/Resources/Private/AnchorLink/ssri-6.0.2
- dev-dependabot/npm_and_yarn/Resources/Private/AnchorLink/y18n-4.0.1
- dev-dependabot/npm_and_yarn/Resources/Private/AnchorLink/elliptic-6.5.4
- dev-dependabot/npm_and_yarn/Resources/Private/AnchorLink/ini-1.3.8
- dev-dependabot/npm_and_yarn/Resources/Private/AnchorLink/acorn-6.4.1
This package is auto-updated.
Last update: 2024-09-06 19:28:32 UTC
README
通过服务器端可解析的锚点链接扩展Neos CKE5链接编辑器
安装
-
安装包:
composer require diu/neos-anchorlink
-
使用以下配置启用额外的链接选项
"Neos.NodeTypes.BaseMixins:TextMixin": # Or other nodetype properties: text: ui: inline: editorOptions: linking: anchorLink: true
- 对于您希望能够链接到的所有内容节点类型,继承自
DIU.Neos.AnchorLink:AnchorMixin
,例如:
Neos.Neos:Content: # Or other nodetype superTypes: DIU.Neos.AnchorLink:AnchorMixin: true
- 调整这些节点的渲染以在它们之前插入锚点,例如,包含了一个Fusion处理器来帮助完成此操作
prototype(Neos.Neos:Content).@process.anchor = DIU.Neos.AnchorLink:AnchorLinkAugmentor
注意:这将向相应的输出添加一个id
属性。为了可靠地工作,相应的原型应渲染单个根元素。否则,将渲染一个额外的包装div
元素。此外,渲染的内容不得已包含id
属性,因为它将与此处augmentor的属性合并。
配置
可以配置用于链接的内容节点节点类型。还可以通过Settings.yaml使用不同的属性来设置锚点值和标签。
以下是默认值
DIU: Neos: AnchorLink: # Only nodes of this type will appear in the "Choose link anchor" selector contentNodeType: "DIU.Neos.AnchorLink:AnchorMixin" # Eel Expression that returns the anchor (without leading "#") for a given node anchor: ${node.properties.anchor || node.name} # Eel Expression that returns the label to be rendered in the anchor selector in the Backend label: ${node.label} # Eel Expression that returns a group for the anchor selector (empty string == no grouping) group: ${I18n.translate(node.nodeType.label)} # Eel Expression that returns an icon for the anchor selector (empty string = no icon) icon: ${node.nodeType.fullConfiguration.ui.icon}
可以通过Settings.yaml禁用搜索框或调整其阈值,默认设置如下:
Neos: Neos: Ui: frontendConfiguration: "Diu.Neos.AnchorLink": displaySearchBox: true threshold: 0
低级自定义
最后,可以创建一个完全定制的锚点节点解析器。
创建一个实现AnchorLinkResolverInterface
的类,它将接受当前内容节点、链接和搜索词,并返回一个用于链接锚点选择器的选项数组,并在Objects.yaml
中进行配置,如下所示:
'DIU\Neos\AnchorLink\Controller\AnchorLinkController':
properties:
resolver:
object: Your\Custom\AnchorLinkResolver
开发
如果您需要调整此包中的任何内容,请相应地进行调整,然后按照以下方式重新构建代码:
cd Resources/Private/AnchorLink
yarn && yarn build
然后提交更改的文件,包括Plugin.js