@adobe/cq-react-editable-components

中文文档
1.3.3发布于 2020/08/25Apache-2.0TypeScriptCommonJS近 30 天下载 4737
此软件包已被标记为弃用

Package has been renamed. Please use @adobe/aem-react-editable-components

原始使用文档
文档目录25 节
  1. Installation
  2. Usage
  3. React Components
  4. Map To
  5. Page Model Manager
  6. API
  7. @adobe/cq-react-editable-components 1.3.3
  8. src/Constants.ts
  9. src/Utils.ts
  10. src/HierarchyConstants.ts
  11. Documentation
  12. Changelog
  13. 1.3.2 - 24 August 2020
  14. 1.3.1 - 20 August 2020
  15. 1.3.0 - 20 August 2020
  16. 1.2.1 - 5 June 2020
  17. 1.2.0 - 19 December 2019
  18. 1.1.0 - 5 April 2019
  19. 1.0.4 - 13 December 2018
  20. 1.0.3 - 28 September 2018
  21. 0.0.30 - 20 June 2018
  22. 0.0.29 - 15 May 2018
  23. 0.0.28 - 20 April 2018
  24. Contributing
  25. Licensing

Table of contents

The package is deprecated

The package has been moved. Please use @adobe/aem-react-editable-components

Installation

npm install @adobe/cq-react-editable-components

Usage

This module provides generic React helpers and components supporting AEM authoring.

It also wraps and the following modules (React agnostic):

  • @adobe/cq-spa-component-mapping
  • @adobe/cq-spa-page-model-manager

React Components

The following components can be used to build React SPA aimed at being authored in AEM:

  • ModelProvider, which wraps a portion of the page model into a component
  • Container, which offers dynamic inclusion of its children components
  • ResponsiveGrid, the default container grid component (already mapped to wcm/foundation/components/responsivegrid)

Map To

The MapTo helper can be used to directly associate resource type(s) with a given SPA component.

import { MapTo } from '@adobe/cq-react-editable-components';

class MyComponent {
    ...
}

export default MapTo('my/resource/type')(MyComponent);

Page Model Manager

The PageModelManager API allows to manage the model representation of the AEM pages that are composing a SPA.

The ModelProvider internally uses it to fetch content from AEM and inject it into a given React component. It also keeps the React component in sync when the content in AEM changes.

API

@adobe/cq-react-editable-components 1.3.3

src/Constants.ts

new Constants()

Useful variables for interacting with CQ/AEM components.

Returns
  • Void

src/Utils.ts

isBrowser()

Returns if we are in the browser context or not by checking for the existance of the window object.

Returns
  • Boolean the result of the check of the existance of the window object

Utils()

Helper functions for interacting with the AEM environment.

Returns
  • Void

isInEditor()

Is the app used in the context of the AEM Page editor.

Returns
  • boolean

src/HierarchyConstants.ts

new HierarchyType()

Hierarchical types

Returns
  • Void

Documentation

The technical documentation is already available, but if you are unable to solve your problem or you found a bug you can always contact us and ask for help!

Changelog

1.3.2 - 24 August 2020

  • Deprecating the library. Renaming to aem-react-editable-components.

1.3.1 - 20 August 2020

  • Fix of types

1.3.0 - 20 August 2020

  • Update codebase to TypeScript

1.2.1 - 5 June 2020

  • Update to latest cq-spa-page-model-manager

1.2.0 - 19 December 2019

  • Make react-fast-compare a dependency instead of a peer dependency
  • Remove optional dependencies

1.1.0 - 5 April 2019

  • NEW FEATURE Template Editor
    • Give access to the list of Allowed Components from the ResponsiveGrid component

1.0.4 - 13 December 2018

  • Support for latest cq-spa-page-model-manager and cq-spa-component-mapping API

1.0.3 - 28 September 2018

  • BREAKING CHANGE Refactoring of the Container, ResponsiveGrid and Placeholders to improve extensibility
  • BREAKING CHANGE Relocation of the columnClassNames field from the ResponsiveColumn to the ResponsiveGrid to respect the latest model representation, the field type changed
  • Support for latest cq-spa-page-model-manager API
  • BREAKING CHANGE 'dragDropName' support removed for EditConfig in ComponentMapping

0.0.30 - 20 June 2018

  • BREAKING CHANGE props that are passed to Components renamed:

    • cq_model => cqModel
    • cq_model_page_path => cqModelPagePath
    • cq_model_data_path => cqModelDataPath
  • Responsive grid placeholder not displayed when entering the editor via the preview model

  • Change routing method to support History API by default (hash routing support has been removed)

  • BREAKING CHANGE ModelProvider props renamed:

    • data_path => dataPath
    • page_path => pagePath
    • force_reload => forceReload

0.0.29 - 15 May 2018

Public release of cq-spa-page-model-manager, which provides:

  • Support for the latest version of the com.adobe.cq.export.json.hierarchy API
    • Support and usage of the :path and :children fields to identify a page and its child pages

0.0.28 - 20 April 2018

Initial public release of cq-react-editable-components. Including:

  • @adobe/cq-spa-component-mapping#0.0.15
  • @adobe/cq-spa-page-model-manager#0.0.22.
  • Updated Base React Components with support for multiple pages:
    • Container supports page and items inclusion
    • ModelProvider generates data-cq-page-path and data-cq-data-path attributes (previously: data-cq-content-path) respectively from the cq_model_data_path and cq_model_page_path properties (previously: cq_model_path)

Contributing

Contributions are welcomed! Read the Contributing Guide for more information.

Licensing

This project is licensed under the Apache V2 License. See LICENSE for more information.

版本与发布记录

@adobe/cq-react-editable-components 共发布 22 个版本,首次发布于 2018/04/17;过去 12 个月发布了 0 个版本。

版本发布日期距今
1.3.3latest2020/08/256 年前
1.3.22020/08/246 年前
1.3.12020/08/216 年前
1.3.02020/08/216 年前
1.2.12020/06/066 年前
1.2.02019/12/196 年前

其他发布通道:internal → 0.0.29,beta → 0.0.30。

关于 @adobe/cq-react-editable-components 的常见问题

@adobe/cq-react-editable-components 是什么?

Installation * Usage * API * Documentation * Changelog * Contributing * Licensing注意:该包已被作者标记为弃用——Package has been renamed. Please use @adobe/aem-react-editable-components

如何安装 @adobe/cq-react-editable-components?

在项目目录运行 npm install @adobe/cq-react-editable-components,或使用 pnpm add / yarn add / bun add。它还需要宿主项目提供 peer 依赖:react(^16.13.1)、react-dom(^16.13.1)、@adobe/cq-spa-component-mapping(~1.1.0)、@adobe/cq-spa-page-model-manager(~1.2.0)。npm 7 及以上与 pnpm 8 及以上默认会自动安装必需的 peer 依赖,Yarn 需要手动安装。

@adobe/cq-react-editable-components 支持 TypeScript 吗?

支持。包内自带 TypeScript 类型声明(package.json 声明了 types 入口),安装后即可获得类型提示,无需再安装 @types 包。

@adobe/cq-react-editable-components 支持 ESM 还是 CommonJS?

以 CommonJS 形式发布,可以直接 require();在 ES Module 项目中也可以用 import 引入(Node.js 会把 module.exports 作为默认导出)。

@adobe/cq-react-editable-components 可以商用吗?

@adobe/cq-react-editable-components 使用 Apache-2.0 许可。宽松许可:允许商业使用、修改和再分发,并附带明确的专利授权;分发时需保留许可与 NOTICE 文件,修改过的文件要注明改动。以上为概括,不构成法律意见,请以许可原文为准。

@adobe/cq-react-editable-components 的下载量有多少?

根据 npm 官方下载统计,@adobe/cq-react-editable-components 在 2026/10/05 – 2026/11/03 这 30 天内被下载 4,737 次,日均约 158 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入,适合横向比较热度,不能直接等同于使用人数。

@adobe/cq-react-editable-components 还在维护吗?

最新版本 1.3.3 发布于 2020/08/25(6 年前);至今共发布 22 个版本,其中过去 12 个月发布了 0 个;首次发布于 2018/04/17。作者已将其标记为弃用,新项目建议寻找替代方案。