|
1 | 1 | # Volto iFrame Block (@kitconcept/volto-iframe-block) |
2 | 2 |
|
3 | | -volto-iframe-block: Volto Add-on |
| 3 | +A Volto add-on that provides an iFrame block for embedding external URLs in a Plone/Volto page. |
4 | 4 |
|
5 | 5 | [](https://www.npmjs.com/package/@kitconcept/volto-iframe-block) |
6 | 6 | [](https://kitconcept.github.io/volto-iframe-block/) |
7 | 7 | [](https://github.com/kitconcept/volto-iframe-block/actions/workflows/code.yml) |
8 | 8 | [](https://github.com/kitconcept/volto-iframe-block/actions/workflows/unit.yml) |
9 | 9 |
|
| 10 | +<picture> |
| 11 | + <source media="(prefers-color-scheme: dark)" srcset="https://kitconcept.com/kitconcept-white.svg"> |
| 12 | + <img width="300" alt="kitconcept, GmbH" src="https://kitconcept.com/kitconcept-black.svg"> |
| 13 | +</picture> |
| 14 | + |
| 15 | +## Screenshot |
| 16 | + |
| 17 | +<img alt="Volto iFrame Block" src="https://github.com/user-attachments/assets/bda10986-2785-4a96-9c82-fcd4c45e8b87"> |
| 18 | + |
| 19 | +## Screencast |
| 20 | + |
| 21 | +https://github.com/user-attachments/assets/6f5c85ca-4c09-4574-9bfa-6f1d106ba7c1 |
| 22 | + |
10 | 23 | ## Features |
11 | 24 |
|
12 | | -<!-- List your awesome features here --> |
| 25 | +- **iFrame block** — Registers an `iframe` block that allows editors to embed any external URL inside an `<iframe>` on a Volto page. |
| 26 | +- **URL allowlist** — Supports a configurable `validUrls` list to restrict which URLs editors are permitted to embed, preventing misuse. |
13 | 27 |
|
14 | 28 | ## Installation |
15 | 29 |
|
@@ -84,6 +98,125 @@ Visit http://localhost:3000/ in a browser, login, and check the awesome new feat |
84 | 98 | config.blocks.blocksConfig.iframe.validUrls = ['']; |
85 | 99 | ``` |
86 | 100 |
|
| 101 | +## Development |
| 102 | + |
| 103 | +The development of this add-on is done in isolation using a new approach using pnpm workspaces and latest `mrs-developer` and other Volto core improvements. |
| 104 | +For this reason, it only works with pnpm and Volto 18 (currently in alpha). |
| 105 | + |
| 106 | +### Pre-requisites |
| 107 | + |
| 108 | +- [Node.js](https://6.docs.plone.org/install/create-project.html#node-js) |
| 109 | +- [Make](https://6.docs.plone.org/install/create-project.html#make) |
| 110 | +- [Docker](https://6.docs.plone.org/install/create-project.html#docker) |
| 111 | + |
| 112 | +### Make convenience commands |
| 113 | + |
| 114 | +Run `make help` to list the available commands. |
| 115 | + |
| 116 | +```text |
| 117 | +help Show this help |
| 118 | +install Installs the add-on in a development environment |
| 119 | +start Starts Volto, allowing reloading of the add-on during development |
| 120 | +build Build a production bundle for distribution of the project with the add-on |
| 121 | +i18n Sync i18n |
| 122 | +ci-i18n Check if i18n is not synced |
| 123 | +format Format codebase |
| 124 | +lint Lint, or catch and remove problems, in code base |
| 125 | +release Release the add-on on npmjs.org |
| 126 | +release-dry-run Dry-run the release of the add-on on npmjs.org |
| 127 | +test Run unit tests |
| 128 | +ci-test Run unit tests in CI |
| 129 | +backend-docker-start Starts a Docker-based backend for development |
| 130 | +storybook-start Start Storybook server on port 6006 |
| 131 | +storybook-build Build Storybook |
| 132 | +acceptance-frontend-dev-start Start acceptance frontend in development mode |
| 133 | +acceptance-frontend-prod-start Start acceptance frontend in production mode |
| 134 | +acceptance-backend-start Start backend acceptance server |
| 135 | +ci-acceptance-backend-start Start backend acceptance server in headless mode for CI |
| 136 | +acceptance-test Start Cypress in interactive mode |
| 137 | +ci-acceptance-test Run cypress tests in headless mode for CI |
| 138 | +``` |
| 139 | + |
| 140 | +### Development environment set up |
| 141 | + |
| 142 | +Install package requirements. |
| 143 | + |
| 144 | +```shell |
| 145 | +make install |
| 146 | +``` |
| 147 | + |
| 148 | +### Start developing |
| 149 | + |
| 150 | +Start the backend. |
| 151 | + |
| 152 | +```shell |
| 153 | +make backend-docker-start |
| 154 | +``` |
| 155 | + |
| 156 | +In a separate terminal session, start the frontend. |
| 157 | + |
| 158 | +```shell |
| 159 | +make start |
| 160 | +``` |
| 161 | + |
| 162 | +### Lint code |
| 163 | + |
| 164 | +Run ESlint, Prettier, and Stylelint in analyze mode. |
| 165 | + |
| 166 | +```shell |
| 167 | +make lint |
| 168 | +``` |
| 169 | + |
| 170 | +### Format code |
| 171 | + |
| 172 | +Run ESlint, Prettier, and Stylelint in fix mode. |
| 173 | + |
| 174 | +```shell |
| 175 | +make format |
| 176 | +``` |
| 177 | + |
| 178 | +### i18n |
| 179 | + |
| 180 | +Extract the i18n messages to locales. |
| 181 | + |
| 182 | +```shell |
| 183 | +make i18n |
| 184 | +``` |
| 185 | + |
| 186 | +### Unit tests |
| 187 | + |
| 188 | +Run unit tests. |
| 189 | + |
| 190 | +```shell |
| 191 | +make test |
| 192 | +``` |
| 193 | + |
| 194 | +### Run Cypress tests |
| 195 | + |
| 196 | +Run each of these steps in separate terminal sessions. |
| 197 | + |
| 198 | +In the first session, start the frontend in development mode. |
| 199 | + |
| 200 | +```shell |
| 201 | +make acceptance-frontend-dev-start |
| 202 | +``` |
| 203 | + |
| 204 | +In the second session, start the backend acceptance server. |
| 205 | + |
| 206 | +```shell |
| 207 | +make acceptance-backend-start |
| 208 | +``` |
| 209 | + |
| 210 | +In the third session, start the Cypress interactive test runner. |
| 211 | + |
| 212 | +```shell |
| 213 | +make acceptance-test |
| 214 | +``` |
| 215 | + |
87 | 216 | ## License |
88 | 217 |
|
89 | | -The project is licensed under the MIT license. |
| 218 | +The project is licensed under the MIT license. |
| 219 | + |
| 220 | +## Credits and Acknowledgements 🙏 |
| 221 | + |
| 222 | +Crafted with care by **[kitconcept GmbH](https://kitconcept.com)**. A special thanks to all contributors and supporters! |
0 commit comments