Skip to content
Open
Changes from 1 commit
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
[Yjs Collab] user wp_rand instead of rand
Co-authored-by: Aaron Jorbin <aaronjorbin@users.noreply.github.com>
  • Loading branch information
dmonad and aaronjorbin committed Jan 8, 2025
commit 3a3711b810ed71d3a23acde4f186f1d20d4d85e1
2 changes: 1 addition & 1 deletion lib/experimental/synchronization.php
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ function filter_post_content_ydoc( $data, $postarr, $unsanitized_postarr ) {
}
$content = stripslashes($data['post_content']);
// generate a new clientid for updated content that can be represented as a 53bit unsigned integer (max clientid in Yjs)
$ynewclientid = rand(0, 9007199254740991); // $match[4];
$ynewclientid = wp_rand(0, 9007199254740991); // This is 2^53 – 1 which is `Number.MAX_SAFE_INTEGER` from JavaScript
$updated_yinfo = ''; // '<!-- y:gutenberg version="1" state="" new-content-clientid="' . $ynewclientid . '" -->';
// transform $content if it contains ydoc comment tag
// @todo the following regex doesn't catch the y:gutenberg comment
Expand Down