Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Site editor: 🥝 Media library proof of concept 🥝 #53788

Closed
wants to merge 90 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
90 commits
Select commit Hold shift + click to select a range
6673c19
Initial commit:
ramonjd Aug 17, 2023
8af831f
console.log( 'path', path );
ramonjd Aug 17, 2023
25f782e
Add attachment_tags taxonomy
noisysocks Aug 17, 2023
cc069c4
Media sidebar items
ramonjd Aug 18, 2023
a5825ae
Blah
ramonjd Aug 18, 2023
8fadaad
blah
ramonjd Aug 18, 2023
0a61649
blah
ramonjd Aug 18, 2023
eac9b9a
Use @tanstack/react-table for templates and template-parts
kevin940726 Aug 18, 2023
d788013
Add FilterControl
noisysocks Aug 18, 2023
62d0371
Make filter toggle 40px high
noisysocks Aug 18, 2023
56e71e3
Fetching media entities based on type
ramonjd Aug 18, 2023
8883dc0
Merge remote-tracking branch 'origin/try/site-editor-media-library-bo…
ramonjd Aug 18, 2023
74df510
Neaten up top bar
noisysocks Aug 18, 2023
869d566
Search control
ramonjd Aug 18, 2023
7516f2d
Merge remote-tracking branch 'origin/try/site-editor-media-library-bo…
ramonjd Aug 18, 2023
31872bb
Highlight menu item
ramonjd Aug 18, 2023
34374dd
Use Table in media page
kevin940726 Aug 18, 2023
c355bd4
Saxon's stupid sort control
noisysocks Aug 18, 2023
8019007
Fix lint error
noisysocks Aug 18, 2023
949e888
Style upload button
noisysocks Aug 18, 2023
b1358ff
Wrap everything in a Spacer
noisysocks Aug 18, 2023
a9c6eb4
Refactor to accept the table prop directly
kevin940726 Aug 18, 2023
be6616c
Tweak SearchInput appearance
noisysocks Aug 18, 2023
c5a7109
Add grid support and hook up grid/table toggle.
apeatling Aug 18, 2023
0620f92
Let's show icons!
ramonjd Aug 18, 2023
280b567
Add missing grid styles
apeatling Aug 18, 2023
25c8bdd
Reverse toggle
apeatling Aug 18, 2023
c973fbc
Merge remote-tracking branch 'origin/try/site-editor-media-library-bo…
ramonjd Aug 18, 2023
a797e27
Merge remote-tracking branch 'origin/try/site-editor-media-library-bo…
ramonjd Aug 18, 2023
396c4f3
getting thumbnail for grid
ramonjd Aug 18, 2023
eb08171
EL LINTO DEL DIABLO!
ramonjd Aug 18, 2023
7a1dd8d
Default to table view
noisysocks Aug 18, 2023
532aae0
Hook up tags filtering
kevin940726 Aug 18, 2023
fd73d9e
Basic single item page and nav
ramonjd Aug 18, 2023
6882274
Merge remote-tracking branch 'origin/try/site-editor-media-library-bo…
ramonjd Aug 18, 2023
2221839
Add sorting
kevin940726 Aug 18, 2023
38c4358
Get pagination working
apeatling Aug 18, 2023
8e0ce1b
Merge branch 'try/site-editor-media-library-bonanza' of https://githu…
apeatling Aug 18, 2023
7476dd8
Adding link button to list item
ramonjd Aug 18, 2023
235b05d
Merge remote-tracking branch 'origin/try/site-editor-media-library-bo…
ramonjd Aug 18, 2023
b7766eb
Completely breaking nav - just trying
ramonjd Aug 19, 2023
1b623f1
Add unique ids for rows
kevin940726 Aug 19, 2023
0f3aa07
Add uploading
noisysocks Aug 19, 2023
241f22c
Get pagination styled
apeatling Aug 19, 2023
2cd7645
Merge branch 'try/site-editor-media-library-bonanza' of https://githu…
apeatling Aug 19, 2023
1e0317e
Add TODO note for later
noisysocks Aug 19, 2023
dbe8c7b
Media item page routes. Fooked and fixed
ramonjd Aug 19, 2023
51d68aa
Merge remote-tracking branch 'origin/try/site-editor-media-library-bo…
ramonjd Aug 19, 2023
f6dadaa
Use getMediaTypeFromMimeType
ramonjd Aug 19, 2023
de8cf55
Allow editing and creating tags
noisysocks Aug 19, 2023
1c6b8fc
Add author filter
kevin940726 Aug 19, 2023
bf02966
Add global filter search box
kevin940726 Aug 19, 2023
0961f21
Fix grid view design.
apeatling Aug 19, 2023
d1c6838
Fix grid view design.
apeatling Aug 19, 2023
8631501
Alphabatically sort the title
kevin940726 Aug 19, 2023
8c79ae7
make pretty
SaxonF Aug 19, 2023
4752cc7
Change grid view to use react-table's state
kevin940726 Aug 19, 2023
3ca8d60
idk
SaxonF Aug 19, 2023
2a54625
Using navigation routing for secondary level mediaTypes
ramonjd Aug 19, 2023
3b5158e
Using navigation routing for secondary level mediaTypes
ramonjd Aug 19, 2023
cbddaf8
DEETS YO
ramonjd Aug 19, 2023
3243923
fix tags
SaxonF Aug 19, 2023
5b5d5ad
Merge branch 'try/site-editor-media-library-bonanza' of https://githu…
SaxonF Aug 19, 2023
ce0725c
Add 'Add tag' label when there are no tags
noisysocks Aug 19, 2023
9e88f38
MORE DEETS YO
ramonjd Aug 19, 2023
52273eb
Merge remote-tracking branch 'origin/try/site-editor-media-library-bo…
ramonjd Aug 19, 2023
36d35db
Uploaded date.
ramonjd Aug 19, 2023
95d0e80
Make item preview pwetty
ramonjd Aug 19, 2023
e31c293
Scroll to top after changing pages
kevin940726 Aug 19, 2023
81d19da
More media details
ramonjd Aug 19, 2023
f3c70ba
Add delete action to table view
kevin940726 Aug 19, 2023
5bcd68e
Fix ellipsis button in grid view
noisysocks Aug 19, 2023
55beff1
Add delete to grid ellipsis
noisysocks Aug 19, 2023
e4563e9
Media Preview is now a component
ramonjd Aug 19, 2023
640974f
Merge remote-tracking branch 'origin/try/site-editor-media-library-bo…
ramonjd Aug 19, 2023
717f2c4
Allow creating tag by pressing ENTER
noisysocks Aug 19, 2023
ab3c204
fix thumbnail size
SaxonF Aug 19, 2023
487fc09
Merge branch 'try/site-editor-media-library-bonanza' of https://githu…
SaxonF Aug 19, 2023
2d4cfb0
Move filters to url
kevin940726 Aug 19, 2023
f61f2d8
Add pagination to url
kevin940726 Aug 20, 2023
de0e4c6
Editing image. THis one is for Rob
ramonjd Aug 20, 2023
68bf257
Merge remote-tracking branch 'origin/try/site-editor-media-library-bo…
ramonjd Aug 20, 2023
0fa05f5
Tags in item view
ramonjd Aug 22, 2023
b65f76c
mother flipper
ramonjd Aug 22, 2023
cc0011f
crop is full size
ramonjd Aug 22, 2023
71acbcc
vids
ramonjd Aug 22, 2023
42f3c32
Allow searching for tags, authors, and dates
kevin940726 Aug 22, 2023
23bb378
Don't shrink thumbnail images
kevin940726 Aug 22, 2023
07a55d1
Enable searching for post titles
kevin940726 Aug 22, 2023
bed4f24
[spagetti] fixed width for the first column
kevin940726 Aug 22, 2023
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
28 changes: 28 additions & 0 deletions lib/experimental/media-library.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
<?php

Check failure on line 1 in lib/experimental/media-library.php

View workflow job for this annotation

GitHub Actions / PHP coding standards

Missing file doc comment

function gutenberg_register_attachment_tag_taxonomy() {

Check failure on line 3 in lib/experimental/media-library.php

View workflow job for this annotation

GitHub Actions / PHP coding standards

Missing doc comment for function gutenberg_register_attachment_tag_taxonomy()
register_taxonomy(
'attachment_tag',
'attachment',
array(
'hierarchical' => false,
'query_var' => 'tag',
'rewrite' => false, // TODO: what is this?
'public' => true,
'show_ui' => true,
'show_admin_column' => true,
'_builtin' => true,
'capabilities' => array( // TODO: is this right?
'manage_terms' => 'upload_files',
'edit_terms' => 'upload_files',
'delete_terms' => 'upload_files',
'assign_terms' => 'upload_files',
),
'show_in_rest' => true,
'rest_base' => 'attachment_tags',
'rest_controller_class' => 'WP_REST_Terms_Controller',
)
);
}

add_action( 'init', 'gutenberg_register_attachment_tag_taxonomy' );
1 change: 1 addition & 0 deletions lib/load.php
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,7 @@ function gutenberg_is_experiment_enabled( $name ) {
require __DIR__ . '/experimental/interactivity-api/directives/wp-class.php';
require __DIR__ . '/experimental/interactivity-api/directives/wp-style.php';
require __DIR__ . '/experimental/interactivity-api/directives/wp-text.php';
require __DIR__ . '/experimental/media-library.php';

// Fonts API / Font Face.
remove_action( 'plugins_loaded', '_wp_theme_json_webfonts_handler' ); // Turns off WordPress 6.0's stopgap handler.
Expand Down
96 changes: 96 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@
"@wordpress/warning": "file:packages/warning",
"@wordpress/widgets": "file:packages/widgets",
"@wordpress/wordcount": "file:packages/wordcount",
"react-advanced-cropper": "0.19.3",
"wicg-inert": "3.1.2"
},
"devDependencies": {
Expand Down
2 changes: 1 addition & 1 deletion packages/core-data/src/resolvers.js
Original file line number Diff line number Diff line change
Expand Up @@ -410,7 +410,7 @@ export const canUserEditEntityRecord =
return;
}

const resource = entityConfig.__unstable_rest_base;
const resource = entityConfig.__unstable_rest_base ?? entityConfig.name;
await dispatch( canUser( 'update', resource, recordId ) );
};

Expand Down
2 changes: 1 addition & 1 deletion packages/core-data/src/selectors.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1070,7 +1070,7 @@ export function canUserEditEntityRecord(
if ( ! entityConfig ) {
return false;
}
const resource = entityConfig.__unstable_rest_base;
const resource = entityConfig.__unstable_rest_base ?? entityConfig.name;

return canUser( state, 'update', resource, recordId );
}
Expand Down
3 changes: 3 additions & 0 deletions packages/edit-site/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,10 @@
"react-native": "src/index",
"dependencies": {
"@babel/runtime": "^7.16.0",
"@tanstack/react-table": "^8.9.3",
"@wordpress/a11y": "file:../a11y",
"@wordpress/api-fetch": "file:../api-fetch",
"@wordpress/blob": "file:../blob",
"@wordpress/block-editor": "file:../block-editor",
"@wordpress/block-library": "file:../block-library",
"@wordpress/blocks": "file:../blocks",
Expand Down Expand Up @@ -73,6 +75,7 @@
"fast-deep-equal": "^3.1.3",
"is-plain-object": "^5.0.0",
"memize": "^2.1.0",
"react-advanced-cropper": "0.19.3",
"react-autosize-textarea": "^7.1.0",
"rememo": "^4.0.2",
"remove-accents": "^0.5.0"
Expand Down
8 changes: 7 additions & 1 deletion packages/edit-site/src/components/page-main/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ import { privateApis as routerPrivateApis } from '@wordpress/router';
* Internal dependencies
*/
import PagePatterns from '../page-patterns';
import PageMedia from '../page-media';
import PageMediaItem from '../page-media/page-media-item';
import PageTemplateParts from '../page-template-parts';
import PageTemplates from '../page-templates';
import { unlock } from '../../lock-unlock';
Expand All @@ -15,7 +17,7 @@ const { useLocation } = unlock( routerPrivateApis );

export default function PageMain() {
const {
params: { path },
params: { path, postId, postType },
} = useLocation();

if ( path === '/wp_template/all' ) {
Expand All @@ -24,6 +26,10 @@ export default function PageMain() {
return <PageTemplateParts />;
} else if ( path === '/patterns' ) {
return <PagePatterns />;
} else if ( path && path.startsWith( '/media' ) && ! postId ) {
return <PageMedia />;
} else if ( postType === 'attachment' && !! postId ) {
return <PageMediaItem />;
}

return null;
Expand Down
Loading
Loading