DEPRECATED This project is deprecated in favor of spiral-bridge package
Include writeaway.min.js
in your project. I.e. /node_modules/writeaway-spiral-bridge/writeaway.min.js
For development purposes incluse map file as well, i.e. /node_modules/writeaway-spiral-bridge/writeaway.min.js.map
Typical Spiral Framework PHP initialization sample.
<?php if (spiral(\Spiral\Pieces\Pieces::class)->canEdit()): ?>
<script src="/node_modules/writeaway-spiral-bridge/writeaway.min.js" type="text/javascript">
<script type="text/javascript">
/**
* WriteAwayBridge variable is put in global scope in application entry point by front end engineer
*/
WriteAwayBridge.startForSpiral({
imageGalleryUrl: "<?= uri('api_images_list') ?>", // Url to fetch images list
getPieceUrl: "<?= uri('api_pieces', ['action' => 'get']) ?>", // Url to fetch piece data. This is fired only for pieces that can't be read directly from DOM
saveMetaUrl: "<?= uri('api_seo', ['action' => 'save']) ?>", // Url to save SEO data from SEO editor
savePieceUrl: "<?= uri('api_pieces', ['action' => 'save']) ?>", // Url to save piece. This may be overrided by piece container 'data-save-url' attribute
uploadUrl: "<?= uri('api_images_upload') ?>", // Url to upload image resources
deleteImageUrl: "<?= uri('api_images_delete') ?>" // Url to delete image
},
"" // Specify HTML for custom meta page headers here for SEO Editor
);
</script>
<?php endif; ?>
Add data-get-url
to override get piece URL for specific piece
Add data-save-url
to override save piece URL for specific piece
You can skip calling startForSpiral
method and research how this bundle is done. Also see generic docs and API to implement custom logic.
{
"dependencies": {
"writeaway-spiral-bridge": "git@github.com:writeaway/writeaway-spiral-bridge.git#master"
}
}
- Install node
- Update git submodules
- Run
npm install
andnpm run build
- Run
npm publish