paessler/anchorlink 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

paessler/anchorlink

Composer 安装命令:

composer require paessler/anchorlink

包简介

Extends the Neos CKE5 link-editor custom anchor link option

README 文档

README

Extends the Neos CKE5 link-editor with server-side resolvable anchor links.

anchorlink

Installation

  1. Install the package: composer require paessler/anchorlink

  2. Enable additional linking options with such config:

"Neos.NodeTypes.BaseMixins:TextMixin": # Or other nodetype
  properties:
    text:
      ui:
        inline:
          editorOptions:
            linking:
              anchorLink: true
  1. For all content nodetypes that you would like to be able to link to, inherit from Paessler.AnchorLink:AnchorMixin, e.g.:
Neos.Neos:Content: # Or other nodetype
  superTypes:
    Paessler.AnchorLink:AnchorMixin: true
  1. Adjust the rendering for those nodes to insert anchors before them, e.g. there is included a Fusion processor to help with that:
prototype(Neos.Neos:Content).@process.anchor = Paessler.AnchorLink:AnchorLinkAugmenter

Note: this will add an id attribute to the corresponding output. For this to work reliably the corresponding prototype should render a single root element. Otherwise an additional wrapping div element will be rendered. Also the rendered content must not already contain an id attribute because it would be merged with the one from the augmentor in that case.

Configuration

It's possible to configure the content node nodetype that is used for linking. Also it's possible to use a different property for the anchor value and the label via Settings.yaml.

These are the defaults:

Paessler:
  AnchorLink:
    # Only nodes of this type will appear in the "Choose link anchor" selector
    contentNodeType: "Paessler.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}

It's possible to disable the searchbox or adjust its threshold via Settings.yaml, the default settings are:

Neos:
  Neos:
    Ui:
      frontendConfiguration:
        "Paessler.AnchorLink":
          displaySearchBox: true
          threshold: 0

Low-level Customization

Finally, it is possible to create a completely custom anchor nodes resolver.

Create a class implementing AnchorLinkResolverInterface that would take the current content node, link and a searchTerm and return an array of options for the link anchor selector and configure it in Objects.yaml like this:

'Paessler\AnchorLink\Controller\AnchorLinkController':
  properties:
    resolver:
      object: Your\Custom\AnchorLinkResolver

Development

If you need to adjust anything in this package, just do so and then rebuild the code like this:

cd Resources/Private/JavaScript/AnchorLink
yarn && yarn build

And then commit changed filed including Plugin.js

About

The package is based on the DIU.Neos.AnchorLink package. We thank the DIU team for all the efforts.

paessler/anchorlink 适用场景与选型建议

paessler/anchorlink 是一款 基于 JavaScript 开发的 Composer 扩展包,目前已累计 142 次下载、GitHub Stars 达 4, 最近一次更新时间为 2024 年 01 月 26 日, 在 PHP 生态内属于活跃度较高的组件。

我们在过去多个企业项目中使用过 paessler/anchorlink 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。

围绕 paessler/anchorlink 我们能提供哪些服务?
定制开发 / 二次开发

基于 paessler/anchorlink 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

  • 总下载量: 142
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 4
  • 点击次数: 13
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 4
  • Watchers: 4
  • Forks: 0
  • 开发语言: JavaScript

其他信息

  • 授权协议: MIT
  • 更新时间: 2024-01-26