sitegeist / archaeopteryx
Neos的缺失链接编辑器
Requires
- neos/neos: ^5.3 || ^7.0 || ^8.0 || ^9.0 || dev-master
Requires (Dev)
- mikey179/vfsstream: ^1.6
- neos/buildessentials: ^6.3
- phpstan/phpstan: ^1.10.67
- phpunit/phpunit: ^9.4
- squizlabs/php_codesniffer: ^3.5
This package is auto-updated.
Last update: 2024-09-20 08:06:00 UTC
README
Neos的缺失链接编辑器
作者与赞助商
- Wilhelm Behncke - behncke@sitegeist.de
- Martin Ficzel - ficzel@sitegeist.de
此软件包的开发和公开发布得到了我们的客户https://www.cornelsen.de和雇主https://www.sitegeist.de的慷慨赞助。
安装
composer require sitegeist/archaeopteryx
富文本中的链接
Sitegeist.Archaeopteryx是Neos中用于富文本的默认链接编辑器的即插即用替代品。安装后,如果您尝试在文本中添加链接,将不会显示默认编辑器。
相反,将打开一个带有更多选项的对话框
Sitegeist.Archaeopteryx完全向后兼容。您不必担心系统中的现有链接。您可以在任何时候安装或卸载Sitegeist.Archaeopteryx,同时保留所有链接的完整功能。
检查器属性中的链接
除了与富文本编辑器工具栏的集成外,Sitegeist.Archaeopteryx还提供了一个检查器编辑器,可以用作Neos.Neos/Inspector/Editors/LinkEditor
的替代品。
对于检查器编辑器,Sitegeist.Archaeopteryx不会自动覆盖默认设置。相反,您需要将其明确配置为属性检查器编辑器
'Vendor.Site:MyContent': # ... properties: link: type: string ui: inspector: # ... editor: 'Sitegeist.Archaeopteryx/Inspector/Editors/LinkEditor'
链接类型
Sitegeist.Archaeopteryx附带6种内置链接类型。
Web
Web
链接类型处理外部链接,即以http://
或https://
开头的链接。
文档
Document
链接类型处理内部链接。编辑器提供了一个文档树,您可以从其中选择网站内的文档。它还提供类似于Neos UI左侧栏主文档树中的搜索和节点类型筛选器。
Document
链接类型可以按照以下方式进行配置
RTE配置
'Vendor.Site:MyAwesomeNodeTypeWithSomeRichText': # ... properties: text: type: string ui: inlineEditable: true inline: editorOptions: # .. linking: # # Sitegeist.Archaeopteryx will consider the # startingPoint option in the linking # section of the RTE configuration. # # However, the startingPoint option of the # extra key 'Sitegeist.Archaeopteryx' from # below takes precedence. # startingPoint: '/sites/vendor-site/node-2ohiwg6ardhhf' 'Sitegeist.Archaeopteryx': linkTypes: 'Sitegeist.Archaeopteryx:Node': startingPoint: '/sites/vendor-site/node-40up2e13w4fd9' # Default: current site node baseNodeType: 'Vendor.Site' # default: Neos.Neos:Document loadingDepth: 8 # default: 4 allowedNodeTypes: ['Vendor.Site:Mixin.ReferenceableDocument'] # a list of allowed linkable node types or super types
检查器编辑器配置
'Vendor.Site:MyAwesomeNodeTypeWithALinkProperty': # ... properties: link: type: string ui: inspector: # ... editor: 'Sitegeist.Archaeopteryx/Inspector/Editors/LinkEditor' editorOptions: linkTypes: 'Sitegeist.Archaeopteryx:Node': startingPoint: '/sites/vendor-site/node-40up2e13w4fd9' # Default: current site node baseNodeType: 'Vendor.Site' # default: Neos.Neos:Document loadingDepth: 8 # default: 4 allowedNodeTypes: ['Vendor.Site:Mixin.ReferenceableDocument',] # a list of allowed linkable node types or super types
资产
Asset
链接类型处理来自媒体模块的文件链接。编辑器将提供一个媒体浏览器,您可以从其中选择网站内的任何资产。
邮件到
MailTo
链接类型处理电子邮件链接,即以mailto:
开头的链接。带有mailto:
协议的链接不仅可以指定收件人,还可以配置主题、邮件正文、抄送(CC)收件人和暗抄送(BCC)收件人。
MailTo
链接类型的编辑器将提供所有这些字段。每个字段都可以通过配置停用。
MailTo
链接类型可以按照以下方式进行配置
RTE配置
'Vendor.Site:MyAwesomeNodeTypeWithSomeRichText': # ... properties: text: type: string ui: inlineEditable: true inline: editorOptions: # .. linking: 'Sitegeist.Archaeopteryx': linkTypes: 'Sitegeist.Archaeopteryx:MailTo': enabledFields: subject: true cc: true bcc: true body: true
检查器编辑器配置
'Vendor.Site:MyAwesomeNodeTypeWithALinkProperty': # ... properties: link: type: string ui: inspector: # ... editor: 'Sitegeist.Archaeopteryx/Inspector/Editors/LinkEditor' editorOptions: linkTypes: 'Sitegeist.Archaeopteryx:MailTo': enabledFields: subject: true cc: true bcc: true body: true
电话号码
《PhoneNumber》链接类型处理电话链接,以 tel:
开头,并允许发起通话。在编辑器中,可以选择国家区号,并通过输入字段添加剩余的电话号码。为了便于检查添加的电话号码,预览中会根据所选国家自动格式化。通过节点类型配置,可以定义 defaultCountry
和 favoredCountries
数组。defaultCountry
用于为新的链接预填国家区号。favoredCountries
数组中的值用于定义首选国家列表,这些国家将在编辑器中可选国家区号列表的顶部。所使用的值是 ISO 3166-1 alpha-2(维基百科)国家代码。这两个配置设置都放在 editorOptions
的 linking
分别 linkTypes
部分。
'Vendor.Site:MyAwesomeNodeTypeWithSomeRichText': # ... properties: text: type: string ui: inlineEditable: true inline: editorOptions: # .. linking: 'Sitegeist.Archaeopteryx': linkTypes: 'Sitegeist.Archaeopteryx:PhoneNumber': defaultCountry: FR favoredCountries: - DE - AT - CH - FR
'Vendor.Site:MyAwesomeNodeTypeWithALinkProperty': # ... properties: link: type: string ui: inspector: # ... editor: 'Sitegeist.Archaeopteryx/Inspector/Editors/LinkEditor' editorOptions: linkTypes: 'Sitegeist.Archaeopteryx:PhoneNumber': defaultCountry: FR favoredCountries: - DE - AT - CH - FR
自定义链接
CustomLink
链接类型允许编辑器以任何格式添加链接。这样,当其他链接类型不足以满足特定用例时,您可以为编辑器提供一个逃生口。与其他链接类型一样,CustomLink
可以通过配置禁用。如果您想全局禁用 CustomLink
链接类型,可以使用预设和混合,然后将其用作所有链接生成节点类型的超类型。
定义预设
Neos: Neos: nodeTypes: presets: properties: myVendor: noCustomLinkEditor: ui: inspector: editor: 'Sitegeist.Archaeopteryx/Inspector/Editors/LinkEditor' editorOptions: linkTypes: 'Sitegeist.Archaeopteryx:CustomLink': enabled: false
在您的链接属性、混合或节点类型中使用预设
'MyVendor.Base:Mixin.Link': abstract: true properties: link: options: preset: 'myVendor.noCustomLinkEditor'
链接选项
在 RTE 上下文中,Sitegeist.Archaeopteryx 允许您设置一些额外的链接选项。这些包括
- 锚点:这将向 URL 的哈希部分(
#
后的部分)添加一个字符串 - 标题:这将设置生成的
<a>
标签的title
属性 - 在新窗口中打开:这将设置生成的
<a>
标签的target
属性为_blank
- rel="nofollow":这将设置生成的
<a>
标签的rel
属性为nofollow
并非所有链接类型都支持所有这些选项。以下是一个概述,说明哪些链接类型支持哪些选项
要一般地启用或禁用某些链接选项,您可以使用 RTE 配置中的 linking
部分
'Vendor.Site:MyAwesomeNodeTypeWithSomeRichText': # ... properties: text: type: string ui: inlineEditable: true inline: editorOptions: # .. linking: anchor: true title: true relNofollow: true targetBlank: true
禁用链接类型编辑器
您可以通过配置检查器以及内联可编辑内容元素来禁用一个或多个链接类型编辑器。为此,您使用 linkTypes
部分中特定链接类型编辑器的 enabled
键。此键的默认值为 true
。
RTE配置
'Vendor.Site:MyAwesomeNodeTypeWithSomeRichText': # ... properties: text: type: string ui: inlineEditable: true inline: editorOptions: # .. linking: 'Sitegeist.Archaeopteryx': linkTypes: 'Sitegeist.Archaeopteryx:Asset': enabled: true 'Sitegeist.Archaeopteryx:MailTo': enabled: true # Document node/pages 'Sitegeist.Archaeopteryx:Node': enabled: true 'Sitegeist.Archaeopteryx:PhoneNumber': enabled: false # External links 'Sitegeist.Archaeopteryx:Web': enabled: true 'Sitegeist.Archaeopteryx:CustomLink': enabled: false
检查器编辑器配置
'Vendor.Site:MyAwesomeNodeTypeWithALinkProperty': # ... properties: link: type: string ui: inspector: # ... editor: 'Sitegeist.Archaeopteryx/Inspector/Editors/LinkEditor' editorOptions: linkTypes: 'Sitegeist.Archaeopteryx:Asset': enabled: true 'Sitegeist.Archaeopteryx:MailTo': enabled: true # Document node/pages 'Sitegeist.Archaeopteryx:Node': enabled: true 'Sitegeist.Archaeopteryx:PhoneNumber': enabled: false # External links 'Sitegeist.Archaeopteryx:Web': enabled: true 'Sitegeist.Archaeopteryx:CustomLink': enabled: false
贡献
我们乐于接受贡献。请发送给我们拉取请求。
许可证
请参阅 LICENSE