Giter Site home page Giter Site logo

sitegeist.archaeopteryx's Introduction

Sitegeist.Archaeopteryx

The missing link editor for Neos

Authors & Sponsors

The development and the public-releases of this package was generously sponsored by our customer https://www.cornelsen.de and our employer https://www.sitegeist.de.

Installation

composer require sitegeist/archaeopteryx

Links in Rich Text

Sitegeist.Archaeopteryx is a drop-in replacement for the default Link Editor that is used for Rich Text in Neos. Once installed, you'll notice that the default editor won't show up anymore if you try to add a link to some piece of text.

Instead, a dialog with a lot more options will open:

Sitegeist.Archaeopteryx is fully backwards-compatible. You don't have to worry about links that are already in the system. You can install or uninstall Sitegeist.Archaeopteryx at any point in time while retaining full functionality of all of your links.

Link in Inspector properties

Besides the integration with the Rich Text editor toolbar, Sitegeist.Archaeopteryx also provides an Inspector Editor that can be used as a replacement for Neos.Neos/Inspector/Editors/LinkEditor.

In case of the Inspector Editor, Sitegeist.Archaeopteryx won't automatically override the default. Instead, you need to configure it as a properties' inspector editor explicitly:

'Vendor.Site:MyContent':
  # ...
  properties:
    link:
      type: string
      ui:
        inspector:
          # ...
          editor: 'Sitegeist.Archaeopteryx/Inspector/Editors/LinkEditor'

Link Types

Sitegeist.Archaeopteryx ships with 4 built-in Link Types.

Web

The Web Link Type handles external links, so links that begin with http:// or https://.

Document

The Document Link Type handles internal links. The editor offers you a document tree from which you can select documents from within your site. It also offers a search and a node type filter similar to the main document tree in the left side bar of the Neos UI.

The Document Link Type can be configured as follows:

RTE Configuration:

'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

Inspector Editor Configuration:

'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

The Asset Link Type handles links to files from the Media Module. The editor will offer you a media browser from which you can select any asset from within your site.

Mail To

The MailTo Link Type handles e-mail links, so links that start with mailto:. Links with the mailto: protocol allow not only to specify a recipient, but also to configure a subject, a message body, carbon copy (CC) recipients and blind carbon copy (BCC) recipients for the outgoing e-mail.

The editor for the MailTo Link Type will offer all of those fields. Each field can be deactivated via configuration.

The MailTo Link Type can be configured as follows:

RTE Configuration:

'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

Inspector Editor Configuration:

'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

Phone Number

The PhoneNumber link type handles phone links, which start with tel: and allow to start a call. In the editor one selects the country calling code and add the rest of the phone number via an input field. To make it easier to check the added phone number, it is auto formatted in the preview according to the selected country. Via the the node type configuration you can define a defaultCountry and an array of favoredCountries. The defaultCountry is used to prefill the country calling code for new links. The values from the favoredCountries array are used to define a list of preferred countries, which will be placed at the top of the selectable country calling codes in the editor. The used values are ISO 3166-1 alpha-2 (wikipedia) country codes. Both configuration settings are placed in the linking respectively linkTypes section of the editorOptions:

'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

Custom Link

The CustomLink link type allows the editor to add a link in any format. With this you give the editor an escape hatch if the other link types are insufficient for the desired use case. As any other link type the CustomLink can be deactivated via the configuration. If you want to deactivate the CustomLink link type globally you can use a preset and a mixin, which is than used as a supertype in all link generating node types:

Define the preset:

Neos:
  Neos:
    nodeTypes:
      presets:
        properties:
          myVendor:
            noCustomLinkEditor:
              ui:
                inspector:
                  editor: 'Sitegeist.Archaeopteryx/Inspector/Editors/LinkEditor'
                  editorOptions:
                    linkTypes:
                      'Sitegeist.Archaeopteryx:CustomLink':
                        enabled: false

Use the preset in your link property, mixin or node type

'MyVendor.Base:Mixin.Link':
  abstract: true
  properties:
    link:
      options:
        preset: 'myVendor.noCustomLinkEditor'

Link Options

In RTE context, Sitegeist.Archaeopteryx allows you to set some additional link options. These are:

  • Anchor: This will add a string to the hash-section of the URL (the part after #)
  • Title: This will set the title attribute of the resulting <a>-Tag
  • Open in new window: This will set the target attribute of the resulting <a>-Tag to _blank
  • rel="nofollow": This will set the rel attribute of the resulting <a>-Tag to nofollow

Not all Link Types support all of these options however. Here's an overview of what Link Type supports which options:

Link Type Supported Link Options
Web Anchor, Title, Open in new window, rel="nofollow"
Document Anchor, Title, Open in new window, rel="nofollow"
Asset Title, Open in new window, rel="nofollow"
Mail To - none -

To enable or disable certain Link Options generally, you can use the linking section of your RTE configuration:

'Vendor.Site:MyAwesomeNodeTypeWithSomeRichText':
  # ...
  properties:
    text:
      type: string
      ui:
        inlineEditable: true
        inline:
          editorOptions:
            # ..
            linking:
              anchor: true
              title: true
              relNofollow: true
              targetBlank: true

Disabling Link Type Editors

It is possible to disable one or more link type editors via the configuration for the inspector as well as for inline editable content elements. To achieve this, you use the enabled key for the specific link type editor in the linkTypes section. The default for this key is true.

RTE Configuration

'Vendor.Site:MyAwesomeNodeTypeWithSomeRichText':
  # ...
  properties:
    text:
      type: string
      ui:
        inlineEditable: true
        inline:
          editorOptions:
            # ..
            linking:
              'Sitegeist.Archaeopteryx':
                linkTypes:
                  'Sitegeist.Archaeopteryx:MailTo':
                    enabled: false

Inspector Editor Configuration

'Vendor.Site:MyAwesomeNodeTypeWithALinkProperty':
  # ...
  properties:
    link:
      type: string
      ui:
        inspector:
          # ...
          editor: 'Sitegeist.Archaeopteryx/Inspector/Editors/LinkEditor'
          editorOptions:
            linkTypes:
              'Sitegeist.Archaeopteryx:MailTo':
                enabled: false

Contribution

We will gladly accept contributions. Please send us pull requests.

LICENSE

see LICENSE

sitegeist.archaeopteryx's People

Contributors

andrehoffmann30 avatar grebaldi avatar mficzel avatar mhsdesign avatar nezaniel avatar soee avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

sitegeist.archaeopteryx's Issues

You still have changes - Warning after deleting and updating required inspector link-property

Hello,

the problem is a bit more complicated to describe, so a slightly different listing:

Initial situation:

  • Property in Inspector is set to required
  • A link (NodeType) is already integrated and published

What do I do that the error comes:

  • Remove link via trash can
  • Apply button remains disabled due to required
  • Click on "Create Link
  • Window of Archaeopteryx opens
  • Clicking on the window brings the error message: "You still have changes. What do you want to do with them?"

So I can continue working:

  • Click on Throw away

UI Improvment

Is it possible to remove the css max-width: 264px; at the .node__header__labelWrapper___dJ7OH at the document tree list?

Otherwise, the long page names will be shortened even though there is more space available.

SCR-20221128-eo1_3

BUG: Overlay / stacked dialog issue with Sitegeist.Archaeopteryx Editor in Neos UI 8.3.1^

Description

When creating a link with the Sitegeist.Archaeopteryx Editor the Link overlay from the editor is stacked under the UI overlay. But the link overlay should be displayed first.

Steps to Reproduce

  1. Install (https://github.com/sitegeist/Sitegeist.Archaeopteryx)
  2. Adjust your NodeType for example the TextWithImage NodeType:
    link:
      type: string
      ui:
        label: Link
        showInCreationDialog: true
        help:
          message: 'Create a link'
        inspector:
          editor: 'Sitegeist.Archaeopteryx/Inspector/Editors/LinkEditor'
  1. Try too create a link.

Expected behavior

The overlay of from the Archaeopteryx editor should be at the first.

Actual behavior

The link overlay from the Archaeopteryx gets stacked under the UI overlay

neos-ui-overlay.mov

[What actually happened]

Affected Versions

Neos: 8.3

UI: 8.3.3

You can get this information by running composer show or using the package management module within Neos.
The UI version can also be found inside the left sidebar after version 1.0.3.

Originally posted by @crydotsnake in neos/neos-ui#3583

UX: Don't show current link in non-matching tab

Currently, if a link is set, it is displayed in all tabs:

image

This is misleading because in the example above an external link is displayed as link target inside the internal page tab.

IMO it would make more sense to place this box outside the tab navigation:

image

What do you think?

Does not work inside RichTextEditor if validation of another property failed

If you use a property with the RichTextEditor, you cannot set a link because the link editor modal is behind the Rich Text Editor.

How to test

  • Configure a RTE property:
    foo:
      type: string
      ui:
        label: 'Foo'
        reloadIfChanged: true
        inspector:
          group: foo
          editor: 'Neos.Neos/Inspector/Editors/RichTextEditor'
          editorOptions:
            linking:
              'Sitegeist.Archaeopteryx':
                linkTypes:
                  'Sitegeist.Archaeopteryx:Node':
                    allowedNodeTypes: ['My.Site:Document.Mixin.LinkablePage']
  • Open the RTE
  • Try adding a link

BUG: Node-Links with Hashes

In the Neos Core link editor, editors defined node links with additional hashs in the form node://XXXX#section-id

This is supported and work, now installing Archaeopteryx leads to error, e.g. "node://7b7a2070-0e85-44b6-92b7-c4135e3555b5#ausschreibungen" breaks like this making it impossible to edit:
Bildschirmfoto 2024-04-10 um 21 53 44

The same error can be achieved by picking the custom editor and then entering "node://7b7a2070-0e85-44b6-92b7-c4135e3555b5#ausschreibungen"

As a minimum the editor should show this as a custom link and not fully break. Fixed with #60

BUG: `relNofollow` is not applied to link

Bildschirmaufnahme.2023-10-23.um.17.43.32.mov

As far as i can tell, this

In https://github.com/sitegeist/Sitegeist.Archaeopteryx/blame/a003751455ccd6759cd6968dea11c08481ee4296/Neos.Ui/core/src/application/Dialog/Dialog.tsx#L33-L40 we filter out unsupported link options, but as we declare the field relNofollow internally with a different casing relNoFollow, we always filter it out:

{props.enabledLinkOptions.includes('relNofollow') ? (
<Field<boolean>
type="checkbox"
name="options.relNoFollow"

My thesis is that the relNofollow has never worked before.

Hash link does not work

If you have an link with an hash (e.g. #newsletter) the editor returns following error:

Could not find an editor suitable for "#newsletter"

And if I try to click + Create Link I got the error:

TypeError
can't access property "useResolvedModel", linkType is null

Missing setting "TargetBlank" and "RelNofollow" in Inspector view

Thanks for the nice Link-Editor!

Am I missing something or is it not possible to activate the options "TargetBlank" and "RelNofollow" in the Inspector view?

  inspector:
    group: 'image'
    editor: 'Sitegeist.Archaeopteryx/Inspector/Editors/LinkEditor'
    editorOptions:
      # doesn't work
      # linking:
         #  relNofollow: true
         # targetBlank: true
      linkTypes:
        # doesn't work
        # 'Sitegeist.Archaeopteryx:Web':
         #  relNofollow: true
         # targetBlank: true
        'Sitegeist.Archaeopteryx:PhoneNumber':
          enabled: false

"tel:" link isn't working

I already had some links on my site using the tel: ... scheme.

After installing Archaeopteryx and trying to edit these links, the following error occurs:

TypeError: Cannot read property 'useResolvedModel' of null
    at DialogWithValue (.../_Resources/Static/Packages/Sitegeist.Archaeopteryx/JavaScript/Plugin.js?f0f01c36:34134:27)
    at oh (.../_Resources/Static/Packages/Neos.Neos.Ui.Compiled/JavaScript/Host.js?41a91e0c:2:1031880)
    at xo (.../_Resources/Static/Packages/Neos.Neos.Ui.Compiled/JavaScript/Host.js?41a91e0c:2:1079133)
    at Qj (.../_Resources/Static/Packages/Neos.Neos.Ui.Compiled/JavaScript/Host.js?41a91e0c:2:1071446)
    at Kj (.../_Resources/Static/Packages/Neos.Neos.Ui.Compiled/JavaScript/Host.js?41a91e0c:2:1071371)
    at yj (.../_Resources/Static/Packages/Neos.Neos.Ui.Compiled/JavaScript/Host.js?41a91e0c:2:1068278)
    at .../_Resources/Static/Packages/Neos.Neos.Ui.Compiled/JavaScript/Host.js?41a91e0c:2:1018959
    at w.unstable_runWithPriority (.../_Resources/Static/Packages/Neos.Neos.Ui.Compiled/JavaScript/Host.js?41a91e0c:2:1095451)
    at cg (.../_Resources/Static/Packages/Neos.Neos.Ui.Compiled/JavaScript/Host.js?41a91e0c:2:1018668)
    at fg (.../_Resources/Static/Packages/Neos.Neos.Ui.Compiled/JavaScript/Host.js?41a91e0c:2:1018904)

It would also be great to have the tel: scheme as an option, similar to mailto:

Deleted referenced node is not removable

Neos 7.3
Sitegeist.Archaeopteryx 1.3.1

If a document node is referenced to an deleted node, it shows an exception. The exception doesn't render the buttons to edit/remove the link. It is only possible to remove it by hand within the database.

image

Make tab sorting configurable

With the current version, the sorting of the tabs is more in line with what we expect to be normally requirements, however I still think it would be great to have the editors sortable.

What do you think?

Improve state when opening existing links

When an existing link is edited only the tab of this linktype is visible. The other tabs become visible once the link is cleared.

I would expect that all tabs are visible from the start and a link can be overridden by assigning a new target in any tab.

Support for new Media UI

I don't know how this could be achieved, but it would be great to support the new Media UI if installed. This is already possible for the Image and Asset property editor in Neos, but it doesn't work here. I assume it's a hardcoded dependency to the "old" Media UI?

Naming of the "document" tab

The editor Sitegeist.Archaeopteryx:Node is called "Document" in English and "Dokument" in German, which is in line with the term Document node type and also "Document tree"/"Dokumentenbaum". While I see this consistency, when setting a link, it can be misleading because at least in German, you would think that a "Document" is something like a PDF file.

I'm not sure what others think about the naming. Maybe it would just be good if there was a possibility to override the label.

Allow disabling unneeded linkTypes

Currently, all linkTypes are always visible in the Link Editor. I know that is meant more or less a drop-in replacement for the Link Editor, but the original is already hard to use. It would be a massive advantage if the tabs could be unset or disabled. That way the editor could be used for an external link, internal link, phone number etc. only.

Turn off some editors

It would be nice of an editor could be turned of:

editor: 'Sitegeist.Archaeopteryx/Inspector/Editors/LinkEditor'
editorOptions:
  linkTypes:
    'Sitegeist.Archaeopteryx:Node': false
    'Sitegeist.Archaeopteryx:MailTo': false

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.