diff --git a/.gitignore b/.gitignore index 2565d95b..3a93e0e2 100644 --- a/.gitignore +++ b/.gitignore @@ -7,3 +7,4 @@ www .nx .python-version *~ +packages/web-component/wordpress-plugin/read-along-web-app-loader/js/* diff --git a/packages/web-component/bin/make-wordpress-plugin b/packages/web-component/bin/make-wordpress-plugin new file mode 100644 index 00000000..64a9b7ca --- /dev/null +++ b/packages/web-component/bin/make-wordpress-plugin @@ -0,0 +1,10 @@ +#!/bin/bash +#build the web-component +npx nx build web-component +# delete previous version +rm -rf packages/web-component/wordpress-plugin/read-along-web-app-loader/js/* +rm -rf packages/web-component/wordpress-plugin/read-along-web-app-loader.zip +#add build to plugin and make zip +cp dist/packages/web-component/dist/web-component/* packages/web-component/wordpress-plugin/read-along-web-app-loader/js/ +cd packages/web-component/wordpress-plugin/ +zip a -r ./read-along-web-app-loader.zip ./read-along-web-app-loader diff --git a/packages/web-component/wordpress-plugin/read-along-web-app-loader.zip b/packages/web-component/wordpress-plugin/read-along-web-app-loader.zip index 03b6e1f0..28abdcc3 100644 Binary files a/packages/web-component/wordpress-plugin/read-along-web-app-loader.zip and b/packages/web-component/wordpress-plugin/read-along-web-app-loader.zip differ diff --git a/packages/web-component/wordpress-plugin/read-along-web-app-loader/read-along-web-app-loader.php b/packages/web-component/wordpress-plugin/read-along-web-app-loader/read-along-web-app-loader.php new file mode 100644 index 00000000..6f3ce64b --- /dev/null +++ b/packages/web-component/wordpress-plugin/read-along-web-app-loader/read-along-web-app-loader.php @@ -0,0 +1,98 @@ +` in a WordPress shortcode `[read_along_web_app_loader]`. The plugin does not load the script on all pages on your site; it will only add the script to the pages with the shortcode. -The shortcode accepts two optional attributes: - - The `src` attribute for users with custom scripts; defaults to unpkg.com - - The `version` attribute for which version on unpkg.com defaults; to the latest +This plugin loads the script and styles needed to activate the <read-along> tag in a Word Press site. +This WordPress plugin allows the deployment and activation of a Read-Along generated using https://github.com/ReadAlongs/ on WordPress sites. Just wrap your `` in a WordPress shortcode `[read_along_web_app_loader]`. The plugin does not load the script on all pages on your site; it will only add the script to the pages with the shortcode. +The shortcode accepts one optional attribute: + - The `version` attribute for which version of the read-along generator == Frequently Asked Questions == @@ -31,11 +30,12 @@ There are two ways to generate a read-along. The online web app (download the we == Screenshots == 1. Configure read-along web app component in your WordPress classic editor -2. Sample read-along book +2. Sample read-along book 3. Configure read-along web app component in your WordPress block editor == Changelog == - += 1.3.0= +* Embedded the ReadAlong app scripts = 1.0.0 = * Initial Release diff --git a/packages/web-component/wordpress-plugin/read-along-web-app-loader/wp-read-along-web-app-loader.php b/packages/web-component/wordpress-plugin/read-along-web-app-loader/wp-read-along-web-app-loader.php deleted file mode 100644 index c03428e4..00000000 --- a/packages/web-component/wordpress-plugin/read-along-web-app-loader/wp-read-along-web-app-loader.php +++ /dev/null @@ -1,109 +0,0 @@ - "latest", - "src" => - "https://unpkg.com/@readalongs/web-component@%s/dist/web-component/web-component.esm.js", - ], - $attrs, - $tag - ); - $output = ""; - wp_enqueue_style( - "Read_Along_Web_App_Loader_Font", - "https://fonts.googleapis.com/css?family=Lato%7CMaterial+Icons%7CMaterial+Icons+Outlined", - [], - "1.0.0" - ); - if (!is_null($content)) { - $output = apply_filters("the_content", $content); - } - $src = $attributes["src"]; - //format - if (!array_key_exists("src", $attrs) || stristr($src, "%s")) { - $src = sprintf($src, $attributes["version"]); - } - return $output . - "\n\n" . - sprintf("", $src); -} -/** - * Register read-along formats - */ -function add_read_along_format($mimes = []) -{ - //add key for read along format - $mimes["readalong"] = "text/xml"; - //add other supported audio formats - $mimes["m4a"] = "audio/mp4"; - $mimes["wav"] = "audio/wav"; - - return $mimes; -} -/** - * add the shortcode - * - */ - -function run_read_along_web_app_init() -{ - if (!shortcode_exists("read_along_web_app_loader")) { - add_shortcode( - "read_along_web_app_loader", - "read_along_web_app_loader_short_code" - ); - } -} -/** - * Begins execution of the plugin. - * - * @since 1.0.0 - */ -function run_read_along_web_app() -{ - add_action("init", "run_read_along_web_app_init", 11); //hook to the init -} -run_read_along_web_app(); //run the plugin -add_filter("upload_mimes", "add_read_along_format");//add supported formats