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

Docs: Add available script handles #10510

Merged
merged 4 commits into from
Oct 12, 2018
Merged

Docs: Add available script handles #10510

merged 4 commits into from
Oct 12, 2018

Conversation

ajitbohra
Copy link
Member

@ajitbohra ajitbohra commented Oct 11, 2018

Fixes #10005

Doc all available script handles under References > Scripts

Copy link
Contributor

@chrisvanpatten chrisvanpatten left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great idea for the handbook! Left some grammar notes and questions.

@@ -0,0 +1,60 @@
# Scripts

Editor provides several vendor and custom script to plugin developers. Script name, handle and usage are mentioned in below table.
Copy link
Contributor

@chrisvanpatten chrisvanpatten Oct 11, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Small rewrite on this:

The editor provides several vendor and internal scripts to plugin developers. Script names, handles, and descriptions are documented in the table below.


## WP Scripts

Editor includes number of custom scripts to enable various funcationality and utilities. Plugin developers can utilize them to create blocks, editor plugins or generic plugings utilizing them. All the avilable scripts are listed in below table.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The editor includes a number of packages to enable various pieces of functionality. Plugin developers can utilize them to create blocks, editor plugins, or generic plugins.

Slightly simpler this way :)

docs/reference/scripts.md Show resolved Hide resolved

## Vendor Script

By default, editor includes some popular scripts commonly used by web developers and editor itself. All of them are listed in the table below. Plugin developers can utilize these scripts without adding up to bundle size
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The editor also uses some popular third-party packages and scripts. Plugin developers can use these scripts as well without bundling them in their code (and increasing file sizes).

| [Formdata Polyfill](https://www.npmjs.com/package/formdata-polyfill) | wp-polyfill-formdata| Polyfill conditionally replaces the native implementation |
| [Node Contains Polyfill](https://polyfill.io) | wp-polyfill-node-contains |Polyfill for Node.contains |
| [Element Closest Polyfill](https://www.npmjs.com/package/element-closest) | wp-polyfill-element-closest| Return the closest element matching a selector up the DOM tree |
| [Ecmascript Polyfill](https://babeljs.io/docs/en/babel-polyfill) | wp-polyfill-ecmascript | Emulate a full ES2015+ environment |
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this should probably be ECMAScript

| [React](https://reactjs.org) | react | React is a JavaScript library for building user interfaces |
| [React Dom](https://reactjs.org/docs/react-dom.html) | react-dom | Serves as the entry point to the DOM and server renderers for React, intended to be paired with React |
| [Moment](https://momentjs.com/) | moment| Parse, validate, manipulate, and display dates and times in JavaScript |
| [Tinymce Lists](https://www.tiny.cloud/docs/plugins/lists/) | tinymce-latest-lists| The `lists` plugin allows you to add numbered and bulleted lists to TinyMC |
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TinyMCE is capitalised wrong at the start here, and misspelled at the end :)

docs/reference/scripts.md Show resolved Hide resolved
@chrisvanpatten chrisvanpatten added [Type] Enhancement A suggestion for improvement. [Type] Developer Documentation Documentation for developers labels Oct 11, 2018
@ajitbohra
Copy link
Member Author

@chrisvanpatten thanks for the quick review have updated copy & typos :)

@chrisvanpatten
Copy link
Contributor

@ajitbohra Looks great!

I think my only reservation would be to get polyfills their own section, especially if they're things that users won't have to actively engage with. (I think most of them are just automatic, right? Except maybe the ES5 polyfill which works with babel, yes?)

@ajitbohra ajitbohra mentioned this pull request Oct 11, 2018
92 tasks
Copy link
Contributor

@chrisvanpatten chrisvanpatten left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One small thing, then I think we're good 👍 Thanks @ajitbohra!


## Polyfill Scripts

The editor also uses some polyfill for compatibility with major browsers.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The editor also provides polyfills for certain features that may not be available in all modern browsers.

Small change on this that also tries to address what a polyfill is.

@ajitbohra
Copy link
Member Author

@chrisvanpatten polyfill description updated 👍

Copy link
Contributor

@chrisvanpatten chrisvanpatten left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 LGTM!

@ajitbohra ajitbohra added this to the 4.1 milestone Oct 12, 2018
@ajitbohra ajitbohra merged commit e950522 into master Oct 12, 2018
@ajitbohra ajitbohra deleted the add/docs-script-handlers branch October 12, 2018 12:23
@@ -245,6 +245,12 @@
"markdown_source": "https://raw.githubusercontent.com/WordPress/gutenberg/master/docs/packages.md",
"parent": null
},
{
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is meant to be added to root-manifest.json. There are local changes on master (removing this) when running npm run docs:build.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

my bad you are right needs to be added to root-manifest.json.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What's the difference between the two, just so I understand for the future?

Copy link
Member

@Soean Soean Oct 12, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The root-manifest.json file contains all markdown files from the /docs folder. The npm run docs:build command generates the manifest.json file from the root-manifest.json file and adds docs from packages, data and components to it.

Maybe we should document it somewhere...

@aduth aduth mentioned this pull request Oct 12, 2018
@Soean
Copy link
Member

Soean commented Oct 12, 2018

@gziolo
Copy link
Member

gziolo commented Oct 12, 2018

Nice work! Thanks for wrangling it 👍

Did we miss wp-polyfill?

@ajitbohra
Copy link
Member Author

all wp-polyfill scripts are grouped in a separate section here https://github.com/WordPress/gutenberg/blob/master/docs/reference/scripts.md#polyfill-scripts

let me know if we have missed any thing ?

@gziolo
Copy link
Member

gziolo commented Oct 15, 2018

all wp-polyfill scripts are grouped in a separate section here

Yes, but we also expose wp-polyfill as a script your code can depend on.

@ajitbohra
Copy link
Member Author

can you help me with some info, i guess its here

wp_register_script(

wp-polyfill seems to be aliases to wp-polyfill-ecmascript and loads various polyfills.

Where should we add this under polyfill section or under main WP Scripts section ?

@gziolo
Copy link
Member

gziolo commented Oct 15, 2018

@aduth
Copy link
Member

aduth commented Oct 15, 2018

As mentioned in some previous #core-js meetings, we can look to encourage wp-polyfill as the single simple entry-point for developers to reference as a dependency. We could potentially emphasize this in the docs. Otherwise, I think it's fine to include in the "Polyfill" section.

@ajitbohra
Copy link
Member Author

ajitbohra commented Oct 17, 2018

Missing wp-polyfill added with a recommendation to use it over individual polyfills #10694

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Type] Developer Documentation Documentation for developers [Type] Enhancement A suggestion for improvement.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants