diff --git a/apps/silverback-drupal/composer.json b/apps/silverback-drupal/composer.json index 77ed2e3540..d13b2ca2b6 100644 --- a/apps/silverback-drupal/composer.json +++ b/apps/silverback-drupal/composer.json @@ -19,6 +19,7 @@ } ], "require": { + "amazeelabs/proxy-autosave-form": "^1.0", "amazeelabs/proxy-drupal-core": "^1.0", "amazeelabs/proxy-gutenberg": "^1.0", "amazeelabs/silverback-cli": "@dev", diff --git a/apps/silverback-drupal/composer.lock b/apps/silverback-drupal/composer.lock index c8044eeae4..4b4d6df556 100644 --- a/apps/silverback-drupal/composer.lock +++ b/apps/silverback-drupal/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "7264e1bf4ea87c1331759630566fdf38", + "content-hash": "012fe877cbc2c9b639d7ba5c36cb7ef6", "packages": [ { "name": "alchemy/zippy", @@ -75,6 +75,36 @@ }, "time": "2021-04-13T14:13:44+00:00" }, + { + "name": "amazeelabs/proxy-autosave-form", + "version": "1.0.0", + "dist": { + "type": "path", + "url": "../../packages/composer/amazeelabs/proxy-autosave-form", + "reference": "23649adeab3e049a745c38ff7af351d25d1bfd1c" + }, + "require": { + "drupal/autosave_form": "^1.2" + }, + "type": "library", + "extra": { + "enable-patching": true, + "composer-exit-on-patch-failure": true, + "patches": { + "drupal/autosave_form": { + "Gutenberg support": "./vendor/amazeelabs/proxy-autosave-form/patches/gutenberg-support.patch" + } + } + }, + "license": [ + "GPL-2.0+" + ], + "description": "Proxy package for drupal/autosave_form.", + "homepage": "https://silverback.netlify.app", + "transport-options": { + "relative": true + } + }, { "name": "amazeelabs/proxy-drupal-core", "version": "1.0.0", @@ -112,7 +142,7 @@ "dist": { "type": "path", "url": "../../packages/composer/amazeelabs/proxy-gutenberg", - "reference": "e7ef6cebe38081a54e2013dd22379f12a4e85921" + "reference": "979d42d406306a2afcef01dab94515e80c2d2dd6" }, "require": { "drupal/gutenberg": "^2.0" @@ -124,7 +154,8 @@ "patches": { "drupal/gutenberg": { "Missing core block definitions (#3202756)": "https://git.drupalcode.org/project/gutenberg/-/merge_requests/3/diffs.patch", - "Stuck in Loading in Drupal 9.2 (#3219569)": "https://www.drupal.org/files/issues/2021-06-27/3219569-13-8.x-2.x.patch" + "Stuck in Loading in Drupal 9.2 (#3219569)": "https://www.drupal.org/files/issues/2021-06-27/3219569-13-8.x-2.x.patch", + "Allow additional form submit buttons": "./vendor/amazeelabs/proxy-gutenberg/patches/allow-additional-form-submit-buttons.patch" } } }, @@ -1968,26 +1999,26 @@ }, { "name": "doctrine/collections", - "version": "1.6.7", + "version": "1.6.8", "source": { "type": "git", "url": "https://github.com/doctrine/collections.git", - "reference": "55f8b799269a1a472457bd1a41b4f379d4cfba4a" + "reference": "1958a744696c6bb3bb0d28db2611dc11610e78af" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/doctrine/collections/zipball/55f8b799269a1a472457bd1a41b4f379d4cfba4a", - "reference": "55f8b799269a1a472457bd1a41b4f379d4cfba4a", + "url": "https://api.github.com/repos/doctrine/collections/zipball/1958a744696c6bb3bb0d28db2611dc11610e78af", + "reference": "1958a744696c6bb3bb0d28db2611dc11610e78af", "shasum": "" }, "require": { "php": "^7.1.3 || ^8.0" }, "require-dev": { - "doctrine/coding-standard": "^6.0", - "phpstan/phpstan-shim": "^0.9.2", - "phpunit/phpunit": "^7.0", - "vimeo/psalm": "^3.8.1" + "doctrine/coding-standard": "^9.0", + "phpstan/phpstan": "^0.12", + "phpunit/phpunit": "^7.5 || ^8.5 || ^9.1.5", + "vimeo/psalm": "^4.2.1" }, "type": "library", "autoload": { @@ -2031,9 +2062,9 @@ ], "support": { "issues": "https://github.com/doctrine/collections/issues", - "source": "https://github.com/doctrine/collections/tree/1.6.7" + "source": "https://github.com/doctrine/collections/tree/1.6.8" }, - "time": "2020-07-27T17:53:49+00:00" + "time": "2021-08-10T18:51:53+00:00" }, { "name": "doctrine/instantiator", @@ -2348,6 +2379,50 @@ "issues": "https://www.drupal.org/project/issues/admin_toolbar" } }, + { + "name": "drupal/autosave_form", + "version": "1.2.0", + "source": { + "type": "git", + "url": "https://git.drupalcode.org/project/autosave_form.git", + "reference": "8.x-1.2" + }, + "dist": { + "type": "zip", + "url": "https://ftp.drupal.org/files/projects/autosave_form-8.x-1.2.zip", + "reference": "8.x-1.2", + "shasum": "e7a893dfdba574b74cd77e16be2140d82bb353a6" + }, + "require": { + "drupal/core": "^8 || ^9" + }, + "type": "drupal-module", + "extra": { + "drupal": { + "version": "8.x-1.2", + "datestamp": "1591627224", + "security-coverage": { + "status": "covered", + "message": "Covered by Drupal's security advisory policy" + } + } + }, + "notification-url": "https://packages.drupal.org/8/downloads", + "license": [ + "GPL-2.0-or-later" + ], + "authors": [ + { + "name": "hchonov", + "homepage": "https://www.drupal.org/user/2901211" + } + ], + "description": "Adds autosave feature on forms.", + "homepage": "https://www.drupal.org/project/autosave_form", + "support": { + "source": "https://git.drupalcode.org/project/autosave_form" + } + }, { "name": "drupal/coder", "version": "8.3.13", @@ -2393,16 +2468,16 @@ }, { "name": "drupal/core", - "version": "9.2.3", + "version": "9.2.4", "source": { "type": "git", "url": "https://github.com/drupal/core.git", - "reference": "e9c75c8e2d1395aebb19cad17d6a514945636ecf" + "reference": "c723626030c728ec2f9f6526e6cd5f029c9e628c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/drupal/core/zipball/e9c75c8e2d1395aebb19cad17d6a514945636ecf", - "reference": "e9c75c8e2d1395aebb19cad17d6a514945636ecf", + "url": "https://api.github.com/repos/drupal/core/zipball/c723626030c728ec2f9f6526e6cd5f029c9e628c", + "reference": "c723626030c728ec2f9f6526e6cd5f029c9e628c", "shasum": "" }, "require": { @@ -2641,13 +2716,13 @@ ], "description": "Drupal is an open source content management platform powering millions of websites and applications.", "support": { - "source": "https://github.com/drupal/core/tree/9.2.3" + "source": "https://github.com/drupal/core/tree/9.2.4" }, - "time": "2021-08-03T13:14:21+00:00" + "time": "2021-08-12T17:48:08+00:00" }, { "name": "drupal/core-composer-scaffold", - "version": "9.2.3", + "version": "9.2.4", "source": { "type": "git", "url": "https://github.com/drupal/core-composer-scaffold.git", @@ -2691,13 +2766,13 @@ "drupal" ], "support": { - "source": "https://github.com/drupal/core-composer-scaffold/tree/9.2.3" + "source": "https://github.com/drupal/core-composer-scaffold/tree/9.2.4" }, "time": "2021-07-10T22:39:33+00:00" }, { "name": "drupal/core-dev", - "version": "9.2.3", + "version": "9.2.4", "source": { "type": "git", "url": "https://github.com/drupal/core-dev.git", @@ -2743,13 +2818,13 @@ ], "description": "require-dev dependencies from drupal/drupal; use in addition to drupal/core-recommended to run tests from drupal/core.", "support": { - "source": "https://github.com/drupal/core-dev/tree/9.2.3" + "source": "https://github.com/drupal/core-dev/tree/9.2.4" }, "time": "2021-06-01T16:41:50+00:00" }, { "name": "drupal/core-project-message", - "version": "9.2.3", + "version": "9.2.4", "source": { "type": "git", "url": "https://github.com/drupal/core-project-message.git", @@ -2784,22 +2859,22 @@ "drupal" ], "support": { - "source": "https://github.com/drupal/core-project-message/tree/9.2.3" + "source": "https://github.com/drupal/core-project-message/tree/9.2.4" }, "time": "2020-09-14T13:40:36+00:00" }, { "name": "drupal/core-recommended", - "version": "9.2.3", + "version": "9.2.4", "source": { "type": "git", "url": "https://github.com/drupal/core-recommended.git", - "reference": "20feef210c8506a8cc903bd5ef9ef90dec89e71e" + "reference": "b8f3420017a6e03f1402ee6058c6da16bba9b257" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/drupal/core-recommended/zipball/20feef210c8506a8cc903bd5ef9ef90dec89e71e", - "reference": "20feef210c8506a8cc903bd5ef9ef90dec89e71e", + "url": "https://api.github.com/repos/drupal/core-recommended/zipball/b8f3420017a6e03f1402ee6058c6da16bba9b257", + "reference": "b8f3420017a6e03f1402ee6058c6da16bba9b257", "shasum": "" }, "require": { @@ -2808,7 +2883,7 @@ "doctrine/annotations": "1.13.1", "doctrine/lexer": "1.2.1", "doctrine/reflection": "1.2.2", - "drupal/core": "9.2.3", + "drupal/core": "9.2.4", "egulias/email-validator": "2.1.25", "guzzlehttp/guzzle": "6.5.5", "guzzlehttp/promises": "1.4.1", @@ -2871,9 +2946,9 @@ ], "description": "Locked core dependencies; require this project INSTEAD OF drupal/core.", "support": { - "source": "https://github.com/drupal/core-recommended/tree/9.2.3" + "source": "https://github.com/drupal/core-recommended/tree/9.2.4" }, - "time": "2021-08-03T13:14:21+00:00" + "time": "2021-08-12T17:48:08+00:00" }, { "name": "drupal/cypress", @@ -3253,16 +3328,16 @@ }, { "name": "drush/drush", - "version": "10.5.0", + "version": "10.6.0", "source": { "type": "git", "url": "https://github.com/drush-ops/drush.git", - "reference": "3fd9f7e62ffb7f221e4be8151a738529345d22d5" + "reference": "c86d327359baddb0a2f51bb458703826469a0445" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/drush-ops/drush/zipball/3fd9f7e62ffb7f221e4be8151a738529345d22d5", - "reference": "3fd9f7e62ffb7f221e4be8151a738529345d22d5", + "url": "https://api.github.com/repos/drush-ops/drush/zipball/c86d327359baddb0a2f51bb458703826469a0445", + "reference": "c86d327359baddb0a2f51bb458703826469a0445", "shasum": "" }, "require": { @@ -3386,7 +3461,7 @@ "irc": "irc://irc.freenode.org/drush", "issues": "https://github.com/drush-ops/drush/issues", "slack": "https://drupal.slack.com/messages/C62H9CWQM", - "source": "https://github.com/drush-ops/drush/tree/10.5.0" + "source": "https://github.com/drush-ops/drush/tree/10.6.0" }, "funding": [ { @@ -3394,7 +3469,7 @@ "type": "github" } ], - "time": "2021-05-08T15:49:30+00:00" + "time": "2021-08-13T10:40:40+00:00" }, { "name": "easyrdf/easyrdf", diff --git a/apps/silverback-drupal/config/sync/autosave_form.messages.yml b/apps/silverback-drupal/config/sync/autosave_form.messages.yml new file mode 100644 index 0000000000..e2546d374d --- /dev/null +++ b/apps/silverback-drupal/config/sync/autosave_form.messages.yml @@ -0,0 +1,3 @@ +entity_saved_in_background_alert_message: 'The content has been modified elsewhere. As a result, autosaving has been disabled and autosaved states for the current page have been deleted. Autosave will be reactivated after reloading the page.' +_core: + default_config_hash: In3MY-CuVp64RxCeU5X6rsEhR6jR4Si8OG6BX18DALg diff --git a/apps/silverback-drupal/config/sync/autosave_form.settings.yml b/apps/silverback-drupal/config/sync/autosave_form.settings.yml new file mode 100644 index 0000000000..4ab7adc051 --- /dev/null +++ b/apps/silverback-drupal/config/sync/autosave_form.settings.yml @@ -0,0 +1,11 @@ +interval: 5000 +active_on: + content_entity_forms: true + config_entity_forms: false +notification: + active: true + message: 'Saving draft...' + delay: 1000 +allowed_content_entity_types: { } +_core: + default_config_hash: QnLi3Y7e5T_v9EZqYxRb90E0bBDb2g1y7xREWLKJLC0 diff --git a/apps/silverback-drupal/config/sync/core.extension.yml b/apps/silverback-drupal/config/sync/core.extension.yml index 1b845d84e9..eff2698096 100644 --- a/apps/silverback-drupal/config/sync/core.extension.yml +++ b/apps/silverback-drupal/config/sync/core.extension.yml @@ -1,6 +1,7 @@ module: admin_toolbar: 0 admin_toolbar_tools: 0 + autosave_form: 0 basic_auth: 0 block: 0 block_content: 0 diff --git a/apps/silverback-drupal/config/sync/user.mail.yml b/apps/silverback-drupal/config/sync/user.mail.yml index 25e24299ee..1296ecf679 100644 --- a/apps/silverback-drupal/config/sync/user.mail.yml +++ b/apps/silverback-drupal/config/sync/user.mail.yml @@ -1,29 +1,115 @@ cancel_confirm: - body: "[user:display-name],\n\nA request to cancel your account has been made at [site:name].\n\nYou may now cancel your account on [site:url-brief] by clicking this link or copying and pasting it into your browser:\n\n[user:cancel-url]\n\nNOTE: The cancellation of your account is not reversible.\n\nThis link expires in one day and nothing will happen if it is not used.\n\n-- [site:name] team" + body: |- + [user:display-name], + + A request to cancel your account has been made at [site:name]. + + You may now cancel your account on [site:url-brief] by clicking this link or copying and pasting it into your browser: + + [user:cancel-url] + + NOTE: The cancellation of your account is not reversible. + + This link expires in one day and nothing will happen if it is not used. + + -- [site:name] team subject: 'Account cancellation request for [user:display-name] at [site:name]' password_reset: - body: "[user:display-name],\n\nA request to reset the password for your account has been made at [site:name].\n\nYou may now log in by clicking this link or copying and pasting it into your browser:\n\n[user:one-time-login-url]\n\nThis link can only be used once to log in and will lead you to a page where you can set your password. It expires after one day and nothing will happen if it's not used.\n\n-- [site:name] team" + body: |- + [user:display-name], + + A request to reset the password for your account has been made at [site:name]. + + You may now log in by clicking this link or copying and pasting it into your browser: + + [user:one-time-login-url] + + This link can only be used once to log in and will lead you to a page where you can set your password. It expires after one day and nothing will happen if it's not used. + + -- [site:name] team subject: 'Replacement login information for [user:display-name] at [site:name]' register_admin_created: - body: "[user:display-name],\n\nA site administrator at [site:name] has created an account for you. You may now log in by clicking this link or copying and pasting it into your browser:\n\n[user:one-time-login-url]\n\nThis link can only be used once to log in and will lead you to a page where you can set your password.\n\nAfter setting your password, you will be able to log in at [site:login-url] in the future using:\n\nusername: [user:name]\npassword: Your password\n\n-- [site:name] team" + body: |- + [user:display-name], + + A site administrator at [site:name] has created an account for you. You may now log in by clicking this link or copying and pasting it into your browser: + + [user:one-time-login-url] + + This link can only be used once to log in and will lead you to a page where you can set your password. + + After setting your password, you will be able to log in at [site:login-url] in the future using: + + username: [user:name] + password: Your password + + -- [site:name] team subject: 'An administrator created an account for you at [site:name]' register_no_approval_required: - body: "[user:display-name],\n\nThank you for registering at [site:name]. You may now log in by clicking this link or copying and pasting it into your browser:\n\n[user:one-time-login-url]\n\nThis link can only be used once to log in and will lead you to a page where you can set your password.\n\nAfter setting your password, you will be able to log in at [site:login-url] in the future using:\n\nusername: [user:name]\npassword: Your password\n\n-- [site:name] team" + body: |- + [user:display-name], + + Thank you for registering at [site:name]. You may now log in by clicking this link or copying and pasting it into your browser: + + [user:one-time-login-url] + + This link can only be used once to log in and will lead you to a page where you can set your password. + + After setting your password, you will be able to log in at [site:login-url] in the future using: + + username: [user:name] + password: Your password + + -- [site:name] team subject: 'Account details for [user:display-name] at [site:name]' register_pending_approval: - body: "[user:display-name],\n\nThank you for registering at [site:name]. Your application for an account is currently pending approval. Once it has been approved, you will receive another email containing information about how to log in, set your password, and other details.\n\n-- [site:name] team" + body: |- + [user:display-name], + + Thank you for registering at [site:name]. Your application for an account is currently pending approval. Once it has been approved, you will receive another email containing information about how to log in, set your password, and other details. + + -- [site:name] team subject: 'Account details for [user:display-name] at [site:name] (pending admin approval)' register_pending_approval_admin: - body: "[user:display-name] has applied for an account.\n\n[user:edit-url]" + body: |- + [user:display-name] has applied for an account. + + [user:edit-url] subject: 'Account details for [user:display-name] at [site:name] (pending admin approval)' status_activated: - body: "[user:display-name],\n\nYour account at [site:name] has been activated.\n\nYou may now log in by clicking this link or copying and pasting it into your browser:\n\n[user:one-time-login-url]\n\nThis link can only be used once to log in and will lead you to a page where you can set your password.\n\nAfter setting your password, you will be able to log in at [site:login-url] in the future using:\n\nusername: [user:account-name]\npassword: Your password\n\n-- [site:name] team" + body: |- + [user:display-name], + + Your account at [site:name] has been activated. + + You may now log in by clicking this link or copying and pasting it into your browser: + + [user:one-time-login-url] + + This link can only be used once to log in and will lead you to a page where you can set your password. + + After setting your password, you will be able to log in at [site:login-url] in the future using: + + username: [user:account-name] + password: Your password + + -- [site:name] team subject: 'Account details for [user:display-name] at [site:name] (approved)' status_blocked: - body: "[user:display-name],\n\nYour account on [site:name] has been blocked.\n\n-- [site:name] team" + body: |- + [user:display-name], + + Your account on [site:name] has been blocked. + + -- [site:name] team subject: 'Account details for [user:display-name] at [site:name] (blocked)' status_canceled: - body: "[user:display-name],\n\nYour account on [site:name] has been canceled.\n\n-- [site:name] team" + body: |- + [user:display-name], + + Your account on [site:name] has been canceled. + + -- [site:name] team subject: 'Account details for [user:display-name] at [site:name] (canceled)' langcode: en _core: diff --git a/apps/silverback-drupal/install-cache.zip b/apps/silverback-drupal/install-cache.zip index 890b80d3e5..28fb097260 100644 Binary files a/apps/silverback-drupal/install-cache.zip and b/apps/silverback-drupal/install-cache.zip differ diff --git a/packages/composer/amazeelabs/proxy-autosave-form/composer.json b/packages/composer/amazeelabs/proxy-autosave-form/composer.json new file mode 100644 index 0000000000..28d55e9f1c --- /dev/null +++ b/packages/composer/amazeelabs/proxy-autosave-form/composer.json @@ -0,0 +1,20 @@ +{ + "name": "amazeelabs/proxy-autosave-form", + "type": "library", + "version": "1.0.0", + "description": "Proxy package for drupal/autosave_form.", + "homepage": "https://silverback.netlify.app", + "license": "GPL-2.0+", + "extra": { + "enable-patching": true, + "composer-exit-on-patch-failure": true, + "patches": { + "drupal/autosave_form": { + "Gutenberg support": "./vendor/amazeelabs/proxy-autosave-form/patches/gutenberg-support.patch" + } + } + }, + "require": { + "drupal/autosave_form": "^1.2" + } +} diff --git a/packages/composer/amazeelabs/proxy-autosave-form/package.json b/packages/composer/amazeelabs/proxy-autosave-form/package.json new file mode 100644 index 0000000000..d0393eddf5 --- /dev/null +++ b/packages/composer/amazeelabs/proxy-autosave-form/package.json @@ -0,0 +1,11 @@ +{ + "name": "@-amazeelabs/proxy-autosave-form", + "version": "1.0.0", + "author": "Amazee Labs ", + "publishConfig": { + "access": "public", + "registry": "http://localhost:4873", + "repository": "git@github.com:AmazeeLabs/proxy-autosave-form.git", + "branch": "main" + } +} diff --git a/packages/composer/amazeelabs/proxy-autosave-form/patches/gutenberg-support.patch b/packages/composer/amazeelabs/proxy-autosave-form/patches/gutenberg-support.patch new file mode 100644 index 0000000000..6c65ab7744 --- /dev/null +++ b/packages/composer/amazeelabs/proxy-autosave-form/patches/gutenberg-support.patch @@ -0,0 +1,50 @@ +diff --git a/autosave_form.libraries.yml b/autosave_form.libraries.yml +index a3df61f28b62..ee90118b608d 100644 +--- a/autosave_form.libraries.yml ++++ b/autosave_form.libraries.yml +@@ -12,3 +12,4 @@ drupal.autosave_form: + - core/drupal.dialog + - core/drupal.dialog.ajax + - core/drupal.ajax ++ - gutenberg/edit-node +diff --git a/js/autosave_form.js b/js/autosave_form.js +index d34ac811ef4a..505217a74e36 100644 +--- a/js/autosave_form.js ++++ b/js/autosave_form.js +@@ -3,7 +3,7 @@ + * Defines Javascript behaviors for the autosave_form module. + */ + +-(function ($, Drupal, drupalSettings) { ++(function ($, Drupal, drupalSettings, wp) { + + 'use strict'; + +@@ -192,6 +192,21 @@ + if (Drupal.autosaveForm.autosaveSubmit.is(':disabled') || Drupal.autosaveForm.autosaveSubmit.hasClass('is-disabled')) { + return; + } ++ // If there are gutenberg fields, we need to make sure the textarea value ++ // is updated before autosaving. ++ const $gutenbergFields = $('.field--gutenberg textarea'); ++ if($gutenbergFields.length) { ++ const { data } = wp; ++ $gutenbergFields.each(function(i, element) { ++ // Update editor textarea with gutenberg content. ++ $(element).val(data.select('core/editor').getEditedPostContent()); ++ // We need to update the 'editor-value-is-changed' flag otherwise ++ // the content won't be updated. ++ $(element).data({ 'editor-value-is-changed': true }); ++ $(element).attr('data-editor-value-is-changed', true); ++ }); ++ } ++ + var ajax = findAjaxInstance(ajax_class); + if (ajax) { + if (Drupal.autosaveForm.notification.active) { +@@ -305,4 +320,4 @@ + Drupal.AjaxCommands.prototype.openDialog(ajax, response, status); + }; + +-})(jQuery, Drupal, drupalSettings); ++})(jQuery, Drupal, drupalSettings, window.wp); diff --git a/packages/composer/amazeelabs/proxy-gutenberg/composer.json b/packages/composer/amazeelabs/proxy-gutenberg/composer.json index 83eaa96965..a170f0a726 100644 --- a/packages/composer/amazeelabs/proxy-gutenberg/composer.json +++ b/packages/composer/amazeelabs/proxy-gutenberg/composer.json @@ -11,7 +11,8 @@ "patches": { "drupal/gutenberg": { "Missing core block definitions (#3202756)": "https://git.drupalcode.org/project/gutenberg/-/merge_requests/3/diffs.patch", - "Stuck in Loading in Drupal 9.2 (#3219569)": "https://www.drupal.org/files/issues/2021-06-27/3219569-13-8.x-2.x.patch" + "Stuck in Loading in Drupal 9.2 (#3219569)": "https://www.drupal.org/files/issues/2021-06-27/3219569-13-8.x-2.x.patch", + "Allow additional form submit buttons": "./vendor/amazeelabs/proxy-gutenberg/patches/allow-additional-form-submit-buttons.patch" } } }, diff --git a/packages/composer/amazeelabs/proxy-gutenberg/patches/allow-additional-form-submit-buttons.patch b/packages/composer/amazeelabs/proxy-gutenberg/patches/allow-additional-form-submit-buttons.patch new file mode 100644 index 0000000000..48c8ffcaed --- /dev/null +++ b/packages/composer/amazeelabs/proxy-gutenberg/patches/allow-additional-form-submit-buttons.patch @@ -0,0 +1,87 @@ +diff --git a/js/gutenberg.es6.js b/js/gutenberg.es6.js +index f807a8dc18e9..329c4bf3f892 100644 +--- a/js/gutenberg.es6.js ++++ b/js/gutenberg.es6.js +@@ -316,10 +316,11 @@ + }, 0); + + let isFormValid = false; ++ const $formSubmitButtons = $(element.form).find('.form-submit'); + + // Calling openGeneralSidebar() is not working properly when sidebar + // is hidden. To overcome this we need to call it twice. +- $('#edit-submit, #edit-preview').on('mousedown', e => { ++ $formSubmitButtons.on('mousedown', e => { + const { openGeneralSidebar } = data.dispatch('core/edit-post'); + + isFormValid = element.form.reportValidity(); +@@ -334,7 +335,7 @@ + } + }); + +- $('#edit-submit, #edit-preview').on('click', e => { ++ $formSubmitButtons.on('click', e => { + $(e.currentTarget).attr('active', true); + + // Expand "More Settings" set. +@@ -385,8 +386,7 @@ + + // If none of those buttons were clicked... + if ( +- $source.attr('id') !== 'edit-submit' && +- $source.attr('id') !== 'edit-preview' && ++ !$source.hasClass('form-submit') && + $source.attr('id') !== 'edit-delete' + ) { + // Just stop everything. +diff --git a/js/gutenberg.js b/js/gutenberg.js +index bef6e664ac4d..d75f54635306 100644 +--- a/js/gutenberg.js ++++ b/js/gutenberg.js +@@ -87,7 +87,7 @@ function _asyncToGenerator(fn) { return function () { var gen = fn.apply(this, a + var _this2 = this; + + return _asyncToGenerator(regeneratorRuntime.mark(function _callee3() { +- var _format$editorSetting, contentType, allowedBlocks, blackList, data, blocks, hooks, dispatch, addFilter, unregisterBlockType, registerDrupalStore, registerDrupalBlocks, registerDrupalMedia, key, value, categories, isWelcomeGuide, metaboxesContainer, metaboxForm, isFormValid, formSubmitted; ++ var _format$editorSetting, contentType, allowedBlocks, blackList, data, blocks, hooks, dispatch, addFilter, unregisterBlockType, registerDrupalStore, registerDrupalBlocks, registerDrupalMedia, key, value, categories, isWelcomeGuide, metaboxesContainer, metaboxForm, isFormValid, $formSubmitButtons, formSubmitted; + + return regeneratorRuntime.wrap(function _callee3$(_context3) { + while (1) { +@@ -268,8 +268,9 @@ function _asyncToGenerator(fn) { return function () { var gen = fn.apply(this, a + }, 0); + + isFormValid = false; ++ $formSubmitButtons = $(element.form).find('.form-submit'); + +- $('#edit-submit, #edit-preview').on('mousedown', function (e) { ++ $formSubmitButtons.on('mousedown', function (e) { + var _data$dispatch = data.dispatch('core/edit-post'), + openGeneralSidebar = _data$dispatch.openGeneralSidebar; + +@@ -285,7 +286,7 @@ function _asyncToGenerator(fn) { return function () { var gen = fn.apply(this, a + } + }); + +- $('#edit-submit, #edit-preview').on('click', function (e) { ++ $formSubmitButtons.on('click', function (e) { + $(e.currentTarget).attr('active', true); + + $('#edit-additional-fields').attr('open', ''); +@@ -318,7 +319,7 @@ function _asyncToGenerator(fn) { return function () { var gen = fn.apply(this, a + + $source.removeAttr('active'); + +- if ($source.attr('id') !== 'edit-submit' && $source.attr('id') !== 'edit-preview' && $source.attr('id') !== 'edit-delete') { ++ if (!$source.hasClass('form-submit') && $source.attr('id') !== 'edit-delete') { + e.preventDefault(); + e.stopPropagation(); + return false; +@@ -359,7 +360,7 @@ function _asyncToGenerator(fn) { return function () { var gen = fn.apply(this, a + + return _context3.abrupt('return', true); + +- case 48: ++ case 49: + case 'end': + return _context3.stop(); + }