updated plugin ActivityPub version 8.3.0
This commit is contained in:
@ -2,10 +2,19 @@
|
||||
"$schema": "https://schemas.wp.org/trunk/block.json",
|
||||
"name": "activitypub/remote-reply",
|
||||
"apiVersion": 3,
|
||||
"version": "1.0.0",
|
||||
"version": "8.3.0",
|
||||
"title": "Reply on the Fediverse",
|
||||
"category": "widgets",
|
||||
"description": "",
|
||||
"description": "Allow visitors to reply to your posts from their Fediverse account.",
|
||||
"keywords": [
|
||||
"fediverse",
|
||||
"activitypub",
|
||||
"reply",
|
||||
"comments"
|
||||
],
|
||||
"textdomain": "activitypub",
|
||||
"viewScript": "file:./index.js"
|
||||
"style": "file:./style-view.css",
|
||||
"viewScriptModule": "file:./view.js",
|
||||
"viewScript": "wp-api-fetch",
|
||||
"render": "file:./render.php"
|
||||
}
|
||||
@ -1 +0,0 @@
|
||||
<?php return array('dependencies' => array('react', 'wp-api-fetch', 'wp-components', 'wp-compose', 'wp-dom-ready', 'wp-element', 'wp-i18n', 'wp-primitives'), 'version' => '7160b6399cd924e1c7be');
|
||||
File diff suppressed because one or more lines are too long
215
wp-content/plugins/activitypub/build/remote-reply/render.php
Normal file
215
wp-content/plugins/activitypub/build/remote-reply/render.php
Normal file
@ -0,0 +1,215 @@
|
||||
<?php
|
||||
/**
|
||||
* Server-side rendering of the `activitypub/remote-reply` block.
|
||||
*
|
||||
* @package ActivityPub
|
||||
*/
|
||||
|
||||
use Activitypub\Blocks;
|
||||
|
||||
use function Activitypub\is_activitypub_request;
|
||||
|
||||
if ( is_activitypub_request() || is_feed() ) {
|
||||
return;
|
||||
}
|
||||
|
||||
/* @var array $attributes Block attributes. */
|
||||
$attributes = wp_parse_args( $attributes );
|
||||
|
||||
// Get the comment ID and selected comment URL.
|
||||
$comment_id = $attributes['commentId'] ?? 0;
|
||||
$selected_comment = $attributes['selectedComment'] ?? '';
|
||||
|
||||
// Generate a unique ID for the block.
|
||||
$block_id = 'activitypub-remote-reply-block-' . wp_unique_id();
|
||||
|
||||
// Set up the Interactivity API config.
|
||||
wp_interactivity_config(
|
||||
'activitypub/remote-reply',
|
||||
array(
|
||||
'namespace' => ACTIVITYPUB_REST_NAMESPACE,
|
||||
'i18n' => array(
|
||||
'copied' => __( 'Copied!', 'activitypub' ),
|
||||
'copy' => __( 'Copy', 'activitypub' ),
|
||||
'emptyProfileError' => __( 'Please enter a profile URL or handle.', 'activitypub' ),
|
||||
'genericError' => __( 'An error occurred. Please try again.', 'activitypub' ),
|
||||
'invalidProfileError' => __( 'Please enter a valid profile URL or handle.', 'activitypub' ),
|
||||
),
|
||||
)
|
||||
);
|
||||
|
||||
// Add the block wrapper attributes.
|
||||
$wrapper_attributes = get_block_wrapper_attributes(
|
||||
array(
|
||||
'id' => $block_id,
|
||||
'class' => 'activitypub-remote-reply reply',
|
||||
'data-wp-interactive' => 'activitypub/remote-reply',
|
||||
'data-wp-init' => 'callbacks.init',
|
||||
)
|
||||
);
|
||||
|
||||
$wrapper_context = wp_interactivity_data_wp_context(
|
||||
array(
|
||||
'blockId' => $block_id,
|
||||
'commentId' => $comment_id,
|
||||
'commentURL' => $selected_comment,
|
||||
'copyButtonText' => __( 'Copy', 'activitypub' ),
|
||||
'errorMessage' => '',
|
||||
'isError' => false,
|
||||
'isLoading' => false,
|
||||
'modal' => array( 'isOpen' => false ),
|
||||
'remoteProfile' => '',
|
||||
'shouldSaveProfile' => true,
|
||||
)
|
||||
);
|
||||
|
||||
wp_interactivity_state(
|
||||
'activitypub/remote-reply',
|
||||
array(
|
||||
'hasRemoteUser' => false,
|
||||
'profileURL' => '',
|
||||
'template' => '',
|
||||
)
|
||||
);
|
||||
|
||||
ob_start();
|
||||
?>
|
||||
<div class="activitypub-dialog__section">
|
||||
<h4><?php esc_html_e( 'Original Comment URL', 'activitypub' ); ?></h4>
|
||||
<div class="activitypub-dialog__description">
|
||||
<?php esc_html_e( 'Paste the comment URL into the search field of your favorite open social app or platform.', 'activitypub' ); ?>
|
||||
</div>
|
||||
<div class="activitypub-dialog__button-group">
|
||||
<label for="<?php echo esc_attr( $block_id . '-profile-handle' ); ?>" class="screen-reader-text">
|
||||
<?php esc_html_e( 'Comment URL', 'activitypub' ); ?>
|
||||
</label>
|
||||
<input
|
||||
aria-readonly="true"
|
||||
class="wp-block-search__input"
|
||||
id="<?php echo esc_attr( $block_id . '-profile-handle' ); ?>"
|
||||
readonly
|
||||
tabindex="-1"
|
||||
type="text"
|
||||
value="<?php echo esc_attr( $selected_comment ); ?>"
|
||||
/>
|
||||
<button
|
||||
aria-label="<?php esc_attr_e( 'Copy URL to clipboard', 'activitypub' ); ?>"
|
||||
class="wp-element-button"
|
||||
data-wp-on--click="actions.copyToClipboard"
|
||||
type="button"
|
||||
>
|
||||
<span data-wp-text="context.copyButtonText"></span>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="activitypub-dialog__section">
|
||||
<h4><?php esc_html_e( 'Your Profile', 'activitypub' ); ?></h4>
|
||||
<div class="activitypub-dialog__description">
|
||||
<?php esc_html_e( 'Or, if you know your own profile, we can start things that way!', 'activitypub' ); ?>
|
||||
<?php Blocks::render_modal_help(); ?>
|
||||
</div>
|
||||
<div class="activitypub-dialog__button-group">
|
||||
<label for="<?php echo esc_attr( $block_id . '-remote-profile' ); ?>" class="screen-reader-text">
|
||||
<?php esc_html_e( 'Your Fediverse profile', 'activitypub' ); ?>
|
||||
</label>
|
||||
<input
|
||||
class="wp-block-search__input"
|
||||
data-wp-bind--aria-invalid="context.isError"
|
||||
data-wp-bind--value="context.remoteProfile"
|
||||
data-wp-on--input="actions.updateRemoteProfile"
|
||||
data-wp-on--keydown="actions.onInputKeydown"
|
||||
id="<?php echo esc_attr( $block_id . '-remote-profile' ); ?>"
|
||||
placeholder="<?php esc_attr_e( '@username@example.com', 'activitypub' ); ?>"
|
||||
type="text"
|
||||
/>
|
||||
<button
|
||||
aria-label="<?php esc_attr_e( 'Reply', 'activitypub' ); ?>"
|
||||
class="wp-element-button"
|
||||
data-wp-bind--disabled="context.isLoading"
|
||||
data-wp-on--click="actions.submitRemoteProfile"
|
||||
type="button"
|
||||
>
|
||||
<span data-wp-bind--hidden="context.isLoading"><?php esc_html_e( 'Reply', 'activitypub' ); ?></span>
|
||||
<span data-wp-bind--hidden="!context.isLoading"><?php esc_html_e( 'Loading…', 'activitypub' ); ?></span>
|
||||
</button>
|
||||
</div>
|
||||
<div
|
||||
class="activitypub-dialog__error"
|
||||
data-wp-bind--hidden="!context.isError"
|
||||
data-wp-text="context.errorMessage"
|
||||
></div>
|
||||
<div class="activitypub-dialog__remember">
|
||||
<label>
|
||||
<input
|
||||
checked
|
||||
data-wp-bind--checked="context.shouldSaveProfile"
|
||||
data-wp-on--change="actions.toggleRememberProfile"
|
||||
type="checkbox"
|
||||
/>
|
||||
<?php esc_html_e( 'Save my profile for future comments.', 'activitypub' ); ?>
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
<?php
|
||||
$modal_content = ob_get_clean();
|
||||
|
||||
?>
|
||||
<div
|
||||
<?php echo $wrapper_attributes; // phpcs:ignore WordPress.Security.EscapeOutput ?>
|
||||
<?php echo $wrapper_context; // phpcs:ignore WordPress.Security.EscapeOutput ?>
|
||||
>
|
||||
<div class="activitypub-remote-profile" hidden data-wp-bind--hidden="!state.hasRemoteUser">
|
||||
<a
|
||||
href=""
|
||||
class="comment-reply-link activitypub-remote-profile__link"
|
||||
data-wp-bind--href="state.remoteProfileUrl"
|
||||
target="_blank"
|
||||
>
|
||||
<?php
|
||||
printf(
|
||||
/* translators: %s: profile name */
|
||||
esc_html__( 'Reply as %s', 'activitypub' ),
|
||||
'<span data-wp-text="state.profileURL"></span>'
|
||||
);
|
||||
?>
|
||||
</a>
|
||||
|
||||
<button
|
||||
type="button"
|
||||
class="activitypub-remote-profile__close wp-element-button"
|
||||
data-wp-on--click="actions.deleteRemoteUser"
|
||||
title="<?php esc_attr_e( 'Delete Remote Profile', 'activitypub' ); ?>"
|
||||
>
|
||||
<svg fill="currentColor" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg" width="18" height="18" role="img" aria-hidden="true" focusable="false">
|
||||
<path d="M12 13.06l3.712 3.713 1.061-1.06L13.061 12l3.712-3.712-1.06-1.06L12 10.938 8.288 7.227l-1.061 1.06L10.939 12l-3.712 3.712 1.06 1.061L12 13.061z"></path>
|
||||
</svg>
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<a
|
||||
class="comment-reply-link activitypub-remote-reply__link"
|
||||
data-wp-on--click="actions.toggleModal"
|
||||
data-wp-on--keydown="actions.onReplyLinkKeydown"
|
||||
data-wp-bind--hidden="state.hasRemoteUser"
|
||||
data-wp-bind--aria-expanded="context.modal.isOpen"
|
||||
aria-label="<?php esc_attr_e( 'Reply on the Fediverse', 'activitypub' ); ?>"
|
||||
aria-haspopup="dialog"
|
||||
aria-controls="<?php echo esc_attr( $block_id . '-modal-title' ); ?>"
|
||||
role="button"
|
||||
tabindex="0"
|
||||
hidden
|
||||
>
|
||||
<?php esc_html_e( 'Reply on the Fediverse', 'activitypub' ); ?>
|
||||
</a>
|
||||
|
||||
<?php
|
||||
Blocks::render_modal(
|
||||
array(
|
||||
'id' => $block_id . '-modal',
|
||||
'title' => __( 'Remote Reply', 'activitypub' ),
|
||||
'content' => $modal_content,
|
||||
)
|
||||
);
|
||||
?>
|
||||
</div>
|
||||
<?php
|
||||
@ -1 +0,0 @@
|
||||
.activitypub__modal.components-modal__frame{background-color:#f7f7f7;color:#333}.activitypub__modal.components-modal__frame .components-modal__header-heading,.activitypub__modal.components-modal__frame h4{color:#333;letter-spacing:inherit;word-spacing:inherit}.activitypub__modal.components-modal__frame .components-modal__header .components-button:hover{color:var(--color-white)}.activitypub__dialog{max-width:40em}.activitypub__dialog h4{line-height:1;margin:0}.activitypub__dialog .activitypub-dialog__section{margin-bottom:2em}.activitypub__dialog .activitypub-dialog__remember{margin-top:1em}.activitypub__dialog .activitypub-dialog__description{font-size:var(--wp--preset--font-size--normal,.75rem);margin:.33em 0 1em}.activitypub__dialog .activitypub-dialog__button-group{align-items:flex-end;display:flex;justify-content:flex-end}.activitypub__dialog .activitypub-dialog__button-group svg{height:21px;margin-left:.5em;width:21px}.activitypub__dialog .activitypub-dialog__button-group input{background-color:var(--wp--preset--color--white);border-radius:0 50px 50px 0;border-width:1px;border:1px solid var(--wp--preset--color--black);color:var(--wp--preset--color--black);flex:1;font-size:16px;height:inherit;line-height:1;margin-left:0;padding:15px 23px}.activitypub__dialog .activitypub-dialog__button-group button{align-self:center;background-color:var(--wp--preset--color--black);border-radius:50px 0 0 50px;border-width:1px;color:var(--wp--preset--color--white);font-size:16px;height:inherit;line-height:1;margin-right:0;padding:15px 23px;text-decoration:none}.activitypub__dialog .activitypub-dialog__button-group button:hover{border:inherit}.activitypub-remote-profile-delete{align-self:center;color:inherit;font-size:inherit;height:inherit;padding:0 5px}.activitypub-remote-profile-delete:hover{background:inherit;border:inherit}.activitypub-remote-reply{display:flex}
|
||||
@ -1 +0,0 @@
|
||||
.activitypub__modal.components-modal__frame{background-color:#f7f7f7;color:#333}.activitypub__modal.components-modal__frame .components-modal__header-heading,.activitypub__modal.components-modal__frame h4{color:#333;letter-spacing:inherit;word-spacing:inherit}.activitypub__modal.components-modal__frame .components-modal__header .components-button:hover{color:var(--color-white)}.activitypub__dialog{max-width:40em}.activitypub__dialog h4{line-height:1;margin:0}.activitypub__dialog .activitypub-dialog__section{margin-bottom:2em}.activitypub__dialog .activitypub-dialog__remember{margin-top:1em}.activitypub__dialog .activitypub-dialog__description{font-size:var(--wp--preset--font-size--normal,.75rem);margin:.33em 0 1em}.activitypub__dialog .activitypub-dialog__button-group{align-items:flex-end;display:flex;justify-content:flex-end}.activitypub__dialog .activitypub-dialog__button-group svg{height:21px;margin-right:.5em;width:21px}.activitypub__dialog .activitypub-dialog__button-group input{background-color:var(--wp--preset--color--white);border-radius:50px 0 0 50px;border-width:1px;border:1px solid var(--wp--preset--color--black);color:var(--wp--preset--color--black);flex:1;font-size:16px;height:inherit;line-height:1;margin-right:0;padding:15px 23px}.activitypub__dialog .activitypub-dialog__button-group button{align-self:center;background-color:var(--wp--preset--color--black);border-radius:0 50px 50px 0;border-width:1px;color:var(--wp--preset--color--white);font-size:16px;height:inherit;line-height:1;margin-left:0;padding:15px 23px;text-decoration:none}.activitypub__dialog .activitypub-dialog__button-group button:hover{border:inherit}.activitypub-remote-profile-delete{align-self:center;color:inherit;font-size:inherit;height:inherit;padding:0 5px}.activitypub-remote-profile-delete:hover{background:inherit;border:inherit}.activitypub-remote-reply{display:flex}
|
||||
@ -0,0 +1 @@
|
||||
body.modal-open{overflow:hidden}.activitypub-modal__overlay{--activitypub-modal-background-color:var(--wp--preset--color--base,var(--wp--preset--color--background,#fff));--activitypub-modal-border-color:var(--wp--preset--color--contrast-3,var(--wp--preset--color--light-gray,#e2e4e7));--activitypub-modal-radius:var(--wp--custom--border--radius--medium,8px);--activitypub-modal-shadow:var(--wp--preset--shadow--natural,0 5px 15px rgba(0,0,0,.3));--activitypub-modal-compact-shadow:var(--wp--preset--shadow--natural,0 2px 8px rgba(0,0,0,.1));--activitypub-modal-text-color:var(--wp--preset--color--contrast,var(--wp--preset--color--foreground,inherit));align-items:center;background-color:rgba(0,0,0,.5);bottom:0;color:var(--activitypub-modal-text-color);display:flex;justify-content:center;left:0;margin:0!important;max-width:none!important;padding:1rem;position:fixed;right:0;top:0;z-index:100000}.activitypub-modal__overlay.compact{align-items:flex-start;background-color:transparent;bottom:auto;justify-content:flex-start;left:auto;padding:0;position:absolute;right:auto;top:auto;z-index:100}.activitypub-modal__overlay[hidden]{display:none}.activitypub-modal__frame{animation:activitypub-modal-appear .2s ease-out;background-color:var(--activitypub-modal-background-color);border:1px solid var(--activitypub-modal-border-color);border-radius:var(--activitypub-modal-radius);box-shadow:var(--activitypub-modal-shadow);box-sizing:border-box;color:var(--wp--preset--color--contrast,#1e1e1e);display:flex;flex-direction:column;font-size:inherit;max-height:calc(100vh - 2rem);max-width:660px;overflow:hidden;width:100%}.compact .activitypub-modal__frame{box-shadow:var(--activitypub-modal-compact-shadow);max-height:300px;max-width:-moz-min-content;max-width:min-content;min-width:250px;width:auto}.activitypub-modal__header{align-items:center;border-bottom:1px solid var(--activitypub-modal-border-color);display:flex;flex-shrink:0;justify-content:space-between;padding:2rem 2rem 1.5rem}.compact .activitypub-modal__header{display:none}.activitypub-modal__header .activitypub-modal__close{align-items:center;background:transparent;border:none;border-radius:var(--activitypub-modal-radius);color:inherit;cursor:pointer;display:flex;justify-content:center;padding:.5rem;width:auto}.activitypub-modal__header .activitypub-modal__close:active{border:none;padding:.5rem}.activitypub-modal__title{font-size:130%;font-weight:600;line-height:1.4;margin:0!important}.activitypub-modal__content{overflow-y:auto}.activitypub-dialog__section{border-bottom:1px solid var(--activitypub-modal-border-color,var(--wp--preset--color--light-gray,#f0f0f0));padding:1.5rem 2rem}.activitypub-dialog__section:last-child{border-bottom:none;padding-bottom:2rem}.activitypub-dialog__section h4{font-size:110%;margin-bottom:.5rem;margin-top:0}.activitypub-dialog__description{color:inherit;margin-bottom:1rem}.activitypub-dialog__button-group{align-items:center;display:flex;gap:.5rem;margin-bottom:.5rem;width:100%}.activitypub-dialog__button-group input[type]{background-color:var(--activitypub-modal-background-color,#fff)!important;border:1px solid var(--activitypub-modal-border-color,#949494)!important;border-radius:0;box-sizing:border-box;color:inherit!important;flex:1;font-family:inherit;font-size:1em;line-height:1;margin:0;min-width:0;padding:calc(.667em + 2px)!important}.activitypub-dialog__button-group input[type]::-moz-placeholder{opacity:.5}.activitypub-dialog__button-group input[type]::placeholder{opacity:.5}.activitypub-dialog__button-group input[type][aria-invalid=true]{border-color:var(--wp--preset--color--vivid-red,#b32d2e)!important}.activitypub-dialog__button-group button{background-color:var(--wp--preset--color--contrast,#1e1e1e);border:none;box-sizing:border-box;color:var(--wp--preset--color--base,#fff);cursor:pointer;font-family:inherit;font-size:1em;line-height:1;min-width:22.5%;padding:calc(.667em + 2px) 1.5em;width:auto}.activitypub-dialog__error{color:var(--wp--preset--color--vivid-red,#b32d2e);font-size:90%;margin-top:.5rem}.activitypub-dialog__remember{font-size:90%;margin-top:1rem}.activitypub-dialog__remember label{align-items:center;display:flex;gap:.5rem}.activitypub-dialog__remember input[type=checkbox]{margin:0;position:relative;top:0}@keyframes activitypub-modal-appear{0%{opacity:0;transform:translateY(20px)}to{opacity:1;transform:translateY(0)}}.activitypub-remote-reply{margin-top:24px}.activitypub-remote-reply .activitypub-remote-profile{align-items:center;display:flex;gap:1rem}.activitypub-remote-reply .activitypub-remote-profile__close{align-items:center;border-radius:50%;display:inline-flex;height:24px;justify-content:center;line-height:1;padding:0;width:24px}.activitypub-remote-reply .activitypub-remote-profile__link,.activitypub-remote-reply__link{cursor:pointer;display:inline-block;margin:0!important}.activitypub-remote-profile[hidden],.activitypub-remote-reply__link[hidden]{display:none!important}
|
||||
@ -0,0 +1 @@
|
||||
<?php return array('dependencies' => array('@wordpress/interactivity'), 'version' => '283e9946a5209ff839e1', 'type' => 'module');
|
||||
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user