summaryrefslogtreecommitdiffstatshomepage
path: root/src/wp-includes/js
Commit message (Collapse)AuthorAge
...
* Docs: Improve JSDocs for cropper.js.Adam Silverstein2017-12-03
| | | | | | | Ammends r42352 - include the built media files. git-svn-id: https://develop.svn.wordpress.org/trunk@42353 602fd350-edb4-49c9-b593-d223f7449a82
* Docs: Improve JSDocs for cropper.js.Adam Silverstein2017-12-03
| | | | | | | | | Props manuelaugustin, bramheijmink. Fixes #42677. git-svn-id: https://develop.svn.wordpress.org/trunk@42352 602fd350-edb4-49c9-b593-d223f7449a82
* Code is Poetry.Gary Pendergast2017-11-30
| | | | | | | | | | | | WordPress' code just... wasn't. This is now dealt with. Props jrf, pento, netweb, GaryJ, jdgrimes, westonruter, Greg Sherwood from PHPCS, and everyone who's ever contributed to WPCS and PHPCS. Fixes #41057. git-svn-id: https://develop.svn.wordpress.org/trunk@42343 602fd350-edb4-49c9-b593-d223f7449a82
* Editor: Re-build `tinymce.min.js` after [42191].Weston Ruter2017-11-15
| | | | | | | See #42553. git-svn-id: https://develop.svn.wordpress.org/trunk@42193 602fd350-edb4-49c9-b593-d223f7449a82
* Editor: Disable `wp_keep_scroll_position` in IE11 since buggy; fix `matches` ↵Weston Ruter2017-11-15
| | | | | | | | | | | polyfill conflict with ME.js by doing runtime feature detection in context window. Props westonruter, SergeyBiryukov, Clorith for testing. See #41962, #42029. Fixes #42553 for trunk. git-svn-id: https://develop.svn.wordpress.org/trunk@42191 602fd350-edb4-49c9-b593-d223f7449a82
* Codemirror: Unify line endings in csslint.jsKonstantin Obenland2017-11-02
| | | | | | | | | | This is likely a problem caused upstream and will probably be a non-issue once #41870 is merged in a future release. Fixes #42424. git-svn-id: https://develop.svn.wordpress.org/trunk@42110 602fd350-edb4-49c9-b593-d223f7449a82
* Customize: Prevent `history.replaceState()` and `history.pushState()` calls ↵Weston Ruter2017-11-02
| | | | | | | | | | | from causing error in customize preview before DOM ready. Amends [41597]. See #39896. Fixes #42414. git-svn-id: https://develop.svn.wordpress.org/trunk@42108 602fd350-edb4-49c9-b593-d223f7449a82
* REST API: JS client - Enumerate endpoints supporting trash.Adam Silverstein2017-10-31
| | | | | | | | | | | Improve the logic determining which endpoints support the trash by enumerating them. Endpoints that don't support the trash require `force=true` when deleting. The previous approach relied on the `force` argument description, which is a translated string and was fragile. In the future, we can expose whether an endpoint supports the trash as part of its schema and automate this logic. Props Soean. Fixes #40672. git-svn-id: https://develop.svn.wordpress.org/trunk@42047 602fd350-edb4-49c9-b593-d223f7449a82
* Customize: Support instantiation of partials with flat/unwrapped params for ↵Weston Ruter2017-10-29
| | | | | | | | | | | | | parity with controls, sections, and panels in [41726]. * Passing `options.params` when constructing `Partial` is now deprecated in favor of just passing `options`. * Improve usage of jsdoc in JS `Partial` class. * Also add `defaults` property to `wp.customize.selectiveRefresh.Partial` class for parity with `Control`. See #42083. git-svn-id: https://develop.svn.wordpress.org/trunk@42037 602fd350-edb4-49c9-b593-d223f7449a82
* TinyMCE: Set undefined FloatPanel zIndexElla Van Dorpe2017-10-24
| | | | | | | | | See [40995] for the Customizer. Fixes #42322. git-svn-id: https://develop.svn.wordpress.org/trunk@41993 602fd350-edb4-49c9-b593-d223f7449a82
* Editor: Specify `maxwidth` in `parse-embed` requests based on width of ↵Weston Ruter2017-10-24
| | | | | | | | | editor iframe so that TinyMCE view embeds fit, particularly in Text widgets. See #40854, #34115. git-svn-id: https://develop.svn.wordpress.org/trunk@41985 602fd350-edb4-49c9-b593-d223f7449a82
* Customizer: Improve handling of crops in the media library.Joe McGill2017-10-19
| | | | | | | | | | | | | | | | This is a follow up on r41732, implementing the following improvements: * Attachment parent info is now stored in attachment meta rather than a separate post meta key. * Attachments created from contextual crops (e.g. header, logos, etc.) are filtered out of the media library using a new `_filterContext` method in `wp.media.controller.Library`. Props joemcgill, westonruter. See #21819. git-svn-id: https://develop.svn.wordpress.org/trunk@41937 602fd350-edb4-49c9-b593-d223f7449a82
* Widgets: Prevent MediaElement.js player from overflowing sidebar in Audio ↵Weston Ruter2017-10-16
| | | | | | | | | | | widget. Props bradyvercher. See #39686. Fixes #42244. git-svn-id: https://develop.svn.wordpress.org/trunk@41886 602fd350-edb4-49c9-b593-d223f7449a82
* Media: Add MediaElement.js 2.2 back-compat for MediaElement.js 4.2Weston Ruter2017-10-16
| | | | | | | | | | | | * Introduces `mediaelement-migrate.js`. * Upgrades ME.js from 4.2.5-74e01a40 to 4.2.6-78496d1. Props rafa8626, bradyvercher. See #39686. Fixes #42189. git-svn-id: https://develop.svn.wordpress.org/trunk@41877 602fd350-edb4-49c9-b593-d223f7449a82
* Widgets: Update preview for Gallery widget when one of its attachments is ↵Weston Ruter2017-10-16
| | | | | | | | | | | | | modified in the media modal, outside the customized state. * Ensure that changes to captions are shown in preview when modified in media modal. * Also keep `wp.customize.widgetsPreview.renderedWidgets` updated when widgets are added or removed. See #41914, #37887, #40403. Fixes #41979. git-svn-id: https://develop.svn.wordpress.org/trunk@41872 602fd350-edb4-49c9-b593-d223f7449a82
* Widgets: Rename "Custom Menu" widget to "Navigation Menu".Weston Ruter2017-10-15
| | | | | | | | Props gk.loveweb, ChrisHardie, ajayghaghretiya1, melchoyce. Fixes #40442. git-svn-id: https://develop.svn.wordpress.org/trunk@41868 602fd350-edb4-49c9-b593-d223f7449a82
* Media Grid: Fix escape key sometimes failing to close details modal.Adam Silverstein2017-10-13
| | | | | | | | | | Fix an issue where the escape key would no longer close the attachment details modal after attempting to navigate over the navigation boundaries (by clicking the left arrow key on the first media item or clicking the right arrow key on the last media item). Remove a focus blur which caused the underlying Backbone View to not receive the 'keydown' event. Props subrataemfluence, afercia. Fixes #42180. git-svn-id: https://develop.svn.wordpress.org/trunk@41856 602fd350-edb4-49c9-b593-d223f7449a82
* Customize: Add changeset locking in Customizer to prevent users from ↵Weston Ruter2017-10-12
| | | | | | | | | | | | | | | | | | | | | | | overriding each other's changes. * Customization locking is checked when changesets are saved and when heartbeat ticks. * Lock is lifted immediately upon a user closing the Customizer. * Heartbeat is introduced into Customizer. * Changes made to user after it was locked by another user are stored as an autosave revision for restoration. * Lock notification displays link to preview the other user's changes on the frontend. * A user loading a locked Customizer changeset will be presented with an option to take over. * Autosave revisions attached to a published changeset are converted into auto-drafts so that they will be presented to users for restoration. * Focus constraining is improved in overlay notifications. * Escape key is stopped from propagating in overlay notifications, and it dismisses dismissible overlay notifications. * Introduces `changesetLocked` state which is used to disable the Save button and suppress the AYS dialog when leaving the Customizer. * Fixes bug where users could be presented with each other's autosave revisions. Props sayedwp, westonruter, melchoyce. See #31436, #31897, #39896. Fixes #42024. git-svn-id: https://develop.svn.wordpress.org/trunk@41839 602fd350-edb4-49c9-b593-d223f7449a82
* Media: Fix an issue where audio players overflow playlist containers.Mel Choyce2017-10-12
| | | | | | | | Props celloexpressions. Fixes #41844. git-svn-id: https://develop.svn.wordpress.org/trunk@41838 602fd350-edb4-49c9-b593-d223f7449a82
* Customize: Ensure `customized` changes pending to be written into changeset ↵Weston Ruter2017-10-10
| | | | | | | | | | are successfully injected into Ajax requests in preview. Amends [40704]. See #42162. git-svn-id: https://develop.svn.wordpress.org/trunk@41804 602fd350-edb4-49c9-b593-d223f7449a82
* Customize: Constrain focus when overlay notification is displayed.Weston Ruter2017-10-10
| | | | | | | | | | | * Restore previously-focused element when overlay notifications are dismissed. * Allow notifications to be dismissed via keyboard. Amends [41667]. See #42110, #35210, #39896. git-svn-id: https://develop.svn.wordpress.org/trunk@41803 602fd350-edb4-49c9-b593-d223f7449a82
* Customize: Eliminate use of customize-loader in core so Customizer is opened ↵Weston Ruter2017-10-09
| | | | | | | | | | | | | | | | | | | | | | consistently in `top` window. * Open the door for future browser history feature in #28536, which is currently not feasible when customize-loader is used. * Remove customizer-loader from being used on admin screens for Dashboard, Themes, non-shiny theme install/update. * Keep the customize-loader functionality available for plugins, for the time being. It may become deprecated. * Ensure `return` param in customizer links in Themes screen update to reflect `search` updated by `pushState`. * Persist `return` when reloading Customizer due to theme switch, autosave restoration, or changeset trashing. * Use `location.replace()` instead of changing `location.href` when trashing. * Hide theme browser while Themes screen is loading when there is a `search` to prevent flash of unfiltered themes. * Use throttling instead of debouncing when searching themes to ensure that screen is updated immediately on page load. * Fix encoding and decoding of `search` param between URL and search field. * Add support for dismissing autosaves when closing customize-loader, when it is used by plugins. * Skip sending changeset UUID to customize-loader for population in browser location if changeset branching is not enabled. See #28536. Fixes #40254. git-svn-id: https://develop.svn.wordpress.org/trunk@41797 602fd350-edb4-49c9-b593-d223f7449a82
* Media: Fix MEJS error when removing a media player.Joe McGill2017-10-06
| | | | | | | | | | | This fixes a bug introduced by the upgrade to MediaElement.js, where code calling `wp.media.mixin.removePlayer()` would result in a JS error. Props rafa8626, afercia. Fixes #41787. git-svn-id: https://develop.svn.wordpress.org/trunk@41781 602fd350-edb4-49c9-b593-d223f7449a82
* Build: Webpack instead of Browserify as JavaScript bundler.Adam Silverstein2017-10-04
| | | | | | | | | | Use Webpack as our bundler of choice, enabling improved JavaScript build chain capabilities. Props aduth, netweb, kadamwhite, schlessera. Fixes #40894. git-svn-id: https://develop.svn.wordpress.org/trunk@41752 602fd350-edb4-49c9-b593-d223f7449a82
* Revert "Add `wp.hooks` - JavaScript actions and filters."Adam Silverstein2017-10-04
| | | | | | | | | Revert `wp.hooks` for now as we continue to refine and test. Reverts [41375]. git-svn-id: https://develop.svn.wordpress.org/trunk@41751 602fd350-edb4-49c9-b593-d223f7449a82
* Security: Rename new `wp.sanitize.sanitizeText` to `stripTagsAndEncodeText`.'Adam Silverstein2017-10-04
| | | | | | | | | | | Improve function naming: this function strips tags from a string and also encodes any HTML entities. Props ocean90. Fixes #40635. git-svn-id: https://develop.svn.wordpress.org/trunk@41745 602fd350-edb4-49c9-b593-d223f7449a82
* Customizer: Minimize duplicate header crops in the media library.Joe McGill2017-10-04
| | | | | | | | | | | | | | This adds `Custom_Image_Header::get_previous_crop()`, which finds any previously cropped headers created from the same base image and replaces that attachment rather than creating a new attachment. After updating a crop, the replaced images is also removed from the list of previous header images in the Customizer. See #21819. git-svn-id: https://develop.svn.wordpress.org/trunk@41732 602fd350-edb4-49c9-b593-d223f7449a82
* Customize: Improve usability of Customize JS API.Weston Ruter2017-10-04
| | | | | | | | | | | | | | | | | * Eliminate need to pass both ID and instance in calls to `Values#add()` for panels, sections, controls, settings, partials, and notifications. * Eliminate need to supply `content` param when constructing a `Control`. * Unwrap the `options.params` object passed in constructors to just pass a flat `options`. (Back-compat is maintained.) * Add support for `templateId` param for `Control` to override which template is used for the content. * Remove unused `previewer` being supplied in `Control` instances. * Rename `classes` to `containerClasses` on `Notification`. * Automatically supply `instanceNumber` to improve stable sorting. * Use `api.Notifications` for notifications in settings instead of `api.Value`. See #30741. Fixes #42083. git-svn-id: https://develop.svn.wordpress.org/trunk@41726 602fd350-edb4-49c9-b593-d223f7449a82
* File Editors: Introduce sandboxed live editing of PHP files with rollbacks ↵Weston Ruter2017-10-04
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | for both themes and plugins. * Edits to active plugins which cause PHP fatal errors will no longer auto-deactivate the plugin. Supersedes #39766. * Introduce sandboxed PHP file edits for active themes, preventing accidental whitescreening of a user's site when introducing a fatal error. * After writing a change to a PHP file for an active theme or plugin, perform loopback requests on the file editor admin screens and the homepage to check for fatal errors. If a fatal error is encountered, roll back the edited file and display the error to the user to fix and try again. * Introduce a secure way to scrape PHP fatal errors from a site via `wp_start_scraping_edited_file_errors()` and `wp_finalize_scraping_edited_file_errors()`. * Moves file modifications from `theme-editor.php` and `plugin-editor.php` to common `wp_edit_theme_plugin_file()` function. * Refactor themes and plugin editors to submit file changes via Ajax instead of doing full page refreshes when JS is available. * Use `get` method for theme/plugin dropdowns. * Improve styling of plugin editors, including width of plugin/theme dropdowns. * Improve notices API for theme/plugin editor JS component. * Strip common base directory from plugin file list. See #24048. * Factor out functions to list editable file types in `wp_get_theme_file_editable_extensions()` and `wp_get_plugin_file_editable_extensions()`. * Scroll to line in editor that has linting error when attempting to save. See #41886. * Add checkbox to dismiss lint errors to proceed with saving. See #41887. * Only style the Update File button as disabled instead of actually disabling it for accessibility reasons. * Ensure that value from CodeMirror is used instead of `textarea` when CodeMirror is present. * Add "Are you sure?" check when leaving editor when there are unsaved changes. Supersedes [41560]. See #39766, #24048, #41886. Props westonruter, Clorith, melchoyce, johnbillion, jjj, jdgrimes, azaozz. Fixes #21622, #41887. git-svn-id: https://develop.svn.wordpress.org/trunk@41721 602fd350-edb4-49c9-b593-d223f7449a82
* Accessibility: Change all the `#f00` and `red` to the official WordPress ↵Andrea Fercia2017-10-03
| | | | | | | | | | | | | accent red. WordPress should exclusively use colors from the official colors palette, see https://make.wordpress.org/design/handbook/design-guide/foundations/colors/ Partially addresses accessibility color contrast ratio issues. See #35622. git-svn-id: https://develop.svn.wordpress.org/trunk@41711 602fd350-edb4-49c9-b593-d223f7449a82
* WP-API JS Client: Improve support for meta.Adam Silverstein2017-10-02
| | | | | | | | | | | * Add/fix `getMeta`, `getMetas`, `setMeta` and `setMetas` helpers for models that support meta. * Add tests for new helpers, verify meta support for `Posts`, `Comments`, `Tags` and `Users`. * Include meta data in fixture generation and fixture file driving tests. Fixes #41055. git-svn-id: https://develop.svn.wordpress.org/trunk@41678 602fd350-edb4-49c9-b593-d223f7449a82
* Emoji: Refactor browser support tests.Peter Wilson2017-10-02
| | | | | | | | | | | | | Moves the repeated code in the emoji browser support test to a function to reduced the potential for errors and follow DRY principles. Renames the "emoji4" test "emoji" as unicode version specific tests were removed in [38869]. Props peterwilsoncc, pento for code review. Fixes #41156. git-svn-id: https://develop.svn.wordpress.org/trunk@41669 602fd350-edb4-49c9-b593-d223f7449a82
* Customize: Add infrastructure for trashing/reverting of unpublished changes; ↵Weston Ruter2017-10-02
| | | | | | | | | | | | | | | | | | | | | | introduce full-screen `OverlayNotification` for trashing and theme install/preview. * Introduce a new `wp.customize.previewer.trash()` JS API to trash the current changeset, along with logic to `WP_Customize_Manager` to handle deleting changeset drafts. * Add `trashing` to `wp.customize.state` which is then used to update the UI. * UI for trashing is pending design feedback. One possibility is to add a new trash button to Publish Settings section that invokes `wp.customize.previewer.trash()`. * Improve logic for managing the visibility and disabled states for publish buttons. * Prevent attempting `requestChangesetUpdate` while processing and bump processing while doing `save`. * Update `changeset_date` state only if sent in save response. * Merge `ThemesSection#loadThemePreview()` into `ThemesPanel#loadThemePreview()`. * Remove unused `autosaved` state. * Start autosaving and prompting at beforeunload after a change first happens. This is key for theme previews since even if a user did not make any changes, there were still dirty settings which would get stored in an auto-draft unexpectedly. * Allow `Notification` to accept additional `classes` to be added to `container`. * Introduce `OverlayNotification` and use for theme installing, previewing, and trashing. Such overlay notifications take over the entire window. Props westonruter, celloexpressions. See #37661, #39896, #21666, #35210. git-svn-id: https://develop.svn.wordpress.org/trunk@41667 602fd350-edb4-49c9-b593-d223f7449a82
* REST API JavaScript Client: improve support for model deletion/trash.Adam Silverstein2017-10-01
| | | | | | | | | | | Update the way and location the JavaScript client determines which models/endpoints require the `force=true` parameter when being deleted to avoid a `rest_trash_not_supported` error. Identify models with endpoints that support DELETE, excluding those that support the trash (posts and pages by default). Also, move the check into the default `wp.api.WPApiBaseModel.initialize()` function. Props caercam, euthelup. Fixes #40672. git-svn-id: https://develop.svn.wordpress.org/trunk@41657 602fd350-edb4-49c9-b593-d223f7449a82
* TinyMCE: fix "flickering inline toolbar" in Chrome in RTL mode by not ↵Andrew Ozz2017-09-29
| | | | | | | | showing tooltips while an inline toolbar is shown. Fixes #42018. git-svn-id: https://develop.svn.wordpress.org/trunk@41643 602fd350-edb4-49c9-b593-d223f7449a82
* Customize: Introduce drafting and scheduling for Customizer changesets.Weston Ruter2017-09-27
| | | | | | | | | | | | | | | | | | | | | | | | | | | | * Incorporates code from the Customize Snapshots and Customize Posts feature plugins. * Adds a new Publish Settings section for managing the changeset status, scheduled date, and frontend preview link. * Updates Publish button to reflect the status selected in the Publish Settings (including Save Draft and Schedule). * Deactivates the Themes section when a non-publish status selected, and deactivates the Publish Settings section when previewing a theme switch. * Introduces an `outer` section type (`wp.customize.OuterSection` in JS) for the Publish Settings section to use and for available widgets and available nav menu panels to use in the future. These sections can be expanded while other sections are expanded. * Introduces `WP_Customize_Date_Time_Control` in PHP and `wp.customize.DateTimeControl` in JS for managing a date/time value. * Keeps track of scheduled time and proactively publish from the client when the time arrives, as opposed to waiting for WP Cron. * Auto-publishes a scheduled changeset when attempting to access one that missed its schedule. * Starts a new changeset if attempting to save a changeset that was previously publish. * Adds `force` arg to `requestChangesetUpdate()` to force an update request even when there are no pending changes. * Adds utils methods for `getCurrentTimestamp` and `getRemainingTime`. * Adds new state values for `selectedChangesetStatus`, `changesetDate`, `selectedChangesetDate`. * Fixes logic for when to short-circuit check to close Customizer when there are unsaved changes. * Adds getter methods for `autosaved` and `branching` parameters, with the latter applying the `customize_changeset_branching` filter. * Call to `establish_loaded_changeset` on the fly when `changeset_uuid()` is called if no changeset UUID was specififed. * De-duplicates logic for dismissing auto-draft changesets. * Includes unit tests. Builds on [41597]. Props sayedwp, westonruter, melchoyce, JoshuaWold, folletto, stubgo, karmatosed, dlh, paaljoachim, afercia, johnregan3, utkarshpatel, valendesigns. See #30937. Fixes #39896, #28721, #39275. git-svn-id: https://develop.svn.wordpress.org/trunk@41626 602fd350-edb4-49c9-b593-d223f7449a82
* TinyMCE: update to 4.6.7, changelog: ↵Andrew Ozz2017-09-26
| | | | | | | | https://www.tinymce.com/docs/changelog/#version467september182017. Fixes #41996 #40956 git-svn-id: https://develop.svn.wordpress.org/trunk@41604 602fd350-edb4-49c9-b593-d223f7449a82
* Customize: Extend changesets to support autosave revisions with restoration ↵westonruter2017-09-26
| | | | | | | | | | | | | | | | | | | | | | | notifications, and introduce a new default linear history mode for saved changesets (with a filter for opt-in to changeset branching). * Autosaved changes made on top of `auto-draft` changesets get written on top of the `auto-draft` itself, similar to how autosaves for posts will overwrite post drafts. * Autosaved changes made to saved changesets (e.g. `draft`, `future`) will be placed into an autosave revision for that changeset and that user. * Opening the Customizer will now prompt the user to restore their most recent auto-draft changeset; if notification is dismissed or ignored then the auto-draft will be marked as dismissed and will not be prompted to user in a notification again. * Customizer will no longer automatically supply the `changeset_uuid` param in the `customize.php` URL when branching changesets are not active. * If user closes Customizer explicitly via clicking on X link, then autosave auto-draft/autosave will be dismissed so as to not be prompted again. * If there is a changeset already saved as a `draft` or `future` (UI is forthcoming) then this changeset will now be autoloaded for the user to keep making additional changes. This is the linear model for changesets. * To restore the previous behavior of the Customizer where each session started a new changeset, regardless of whether or not there was an existing changeset saved, there is now a `customize_changeset_branching` hook which can be filtered to return `true`. * `wp.customize.requestChangesetUpdate()` now supports a second with options including `autosave`, `title`, and `date`. * The window `blur` event for `customize.php` has been replaced with a `visibilitychange` event to reduce autosave requests when clicking into preview window. * Adds `autosaved` and `branching` args to `WP_Customize_Manager`. * The `changeset_uuid` param for `WP_Customize_Manager` is extended to recognize a `false` value which causes the Customizer to defer identifying the UUID until `after_setup_theme` in the new `WP_Customize_Manager::establish_loaded_changeset()` method. * A new `customize_autosaved` query parameter can now be supplied which is passed into the `autosaved` arg in `WP_Customize_Manager`; this option is an opt-in to source data from the autosave revision, allowing a user to restore autosaved changes. Props westonruter, dlh, sayedwp, JoshuaWold, melchoyce. See #39896. git-svn-id: https://develop.svn.wordpress.org/trunk@41597 602fd350-edb4-49c9-b593-d223f7449a82
* Plupload: minify and load `plupload.js` and `moxie.js` separately to make ↵Andrew Ozz2017-09-22
| | | | | | | | | them easier to debug. Props gmariani405, azaozz. Fixes #41755. git-svn-id: https://develop.svn.wordpress.org/trunk@41570 602fd350-edb4-49c9-b593-d223f7449a82
* Customizer: retain aspect ration when cropping media w/ shift+click/drag.Adam Silverstein2017-09-21
| | | | | | | | | | Enforce a 1:1 ratio when holding the shift key and dragging in the image cropping tool in the customizer context. Props melchoyce, mikeschroder. Fixes #40211. git-svn-id: https://develop.svn.wordpress.org/trunk@41557 602fd350-edb4-49c9-b593-d223f7449a82
* Remove SWFUpload,Andrew Ozz2017-09-21
| | | | | | | | | | - Refactor swfupload.js to output a simple upload form, and handlers.js. - Delete the SWFUpload plugins directory and swfupload.swf. - Remove flash cookies "hack" from async-upload.php. See #41752. git-svn-id: https://develop.svn.wordpress.org/trunk@41554 602fd350-edb4-49c9-b593-d223f7449a82
* REST API JS Client: Improve nonce handling, refresh stale nonce on sync.Adam Silverstein2017-09-21
| | | | | | | | | | | | | | Keep the nonce used for cookie based authentication fresh by pulling in and using any new nonce supplied in the response headers. * Enable passing nonce to init so each api/endpoint can use a unique nonce. * Store nonce for endpoint on endpointModel. * New model helper `nonce()` retrieves a model's routeModel nonce. * When a response header contains a nonce that doesn't match the stored nonce, replace it. Fixes #40422. git-svn-id: https://develop.svn.wordpress.org/trunk@41553 602fd350-edb4-49c9-b593-d223f7449a82
* TinyMCE: Improve the previews for shortcodes.Dominik Schilling (ocean90)2017-09-19
| | | | git-svn-id: https://develop.svn.wordpress.org/trunk@41395 602fd350-edb4-49c9-b593-d223f7449a82
* Editor: Prevent adding `javascript:` and `data:` URLs through the inline ↵Dominik Schilling (ocean90)2017-09-19
| | | | | | link dialog. git-svn-id: https://develop.svn.wordpress.org/trunk@41393 602fd350-edb4-49c9-b593-d223f7449a82
* Customize: Use `input` event instead of `keyup` or `propertychange` events ↵Weston Ruter2017-09-18
| | | | | | | | | | | | when listening for changes in `wp.customize.Element` instances. Ensures that a control's `Element` is updated in response to pasting into the field. Also fixes issue where inputs using "new" HTML5 types (like `url` and `number`) were not updating in the preview during keystrokes. The use of `input` was previously blocked due to needing to support IE9, but this is no longer a concern since IE<11 is no longer supported. See #38845, #28477. Fixes #35832. git-svn-id: https://develop.svn.wordpress.org/trunk@41387 602fd350-edb4-49c9-b593-d223f7449a82
* Emoji: Invert value returned by UN test for accuracy.Peter Wilson2017-09-17
| | | | | | | | | | | | | The JavaScript testing for UN flag support was passing when it failed, and failing when it passes. This inverts the result to take more traditional approach of returning the correct result. Unprops Pento. Fixes #41852. git-svn-id: https://develop.svn.wordpress.org/trunk@41386 602fd350-edb4-49c9-b593-d223f7449a82
* Media: Rename "Insert Media" window title to "Add Media" for consistency ↵Sergey Biryukov2017-09-16
| | | | | | | | | with the "Add Media" button. Props danieltj. Fixes #41704. git-svn-id: https://develop.svn.wordpress.org/trunk@41383 602fd350-edb4-49c9-b593-d223f7449a82
* wp.sanitize - fix namespace for calls to `stripTags`.Adam Silverstein2017-09-14
| | | | | | | | | | Fixes an `undefined` JavaScript error in PressThis since [41061]. Props afercia. Fixes #41883. git-svn-id: https://develop.svn.wordpress.org/trunk@41379 602fd350-edb4-49c9-b593-d223f7449a82
* Editor: Add CodeMirror-powered code editor with syntax highlighting, ↵Weston Ruter2017-09-13
| | | | | | | | | | | | | | | | | | | | | | linting, and auto-completion. * Code editor is integrated into the Theme/Plugin Editor, Additional CSS in Customizer, and Custom HTML widget. Code editor is not yet integrated into the post editor, and it may not be until accessibility concerns are addressed. * The CodeMirror component in the Custom HTML widget is integrated in a similar way to TinyMCE being integrated into the Text widget, adopting the same approach for integrating dynamic JavaScript-initialized fields. * Linting is performed for JS, CSS, HTML, and JSON via JSHint, CSSLint, HTMLHint, and JSONLint respectively. Linting is not yet supported for PHP. * When user lacks `unfiltered_html` the capability, the Custom HTML widget will report any Kses-invalid elements and attributes as errors via a custom Kses rule for HTMLHint. * When linting errors are detected, the user will be prevented from saving the code until the errors are fixed, reducing instances of broken websites. * The placeholder value is removed from Custom CSS in favor of a fleshed-out section description which now auto-expands when the CSS field is empty. See #39892. * The CodeMirror library is included as `wp.CodeMirror` to prevent conflicts with any existing `CodeMirror` global. * An `wp.codeEditor.initialize()` API in JS is provided to convert a `textarea` into CodeMirror, with a `wp_enqueue_code_editor()` function in PHP to manage enqueueing the assets and settings needed to edit a given type of code. * A user preference is added to manage whether or not "syntax highlighting" is enabled. The feature is opt-out, being enabled by default. * Allowed file extensions in the theme and plugin editors have been updated to include formats which CodeMirror has modes for: `conf`, `css`, `diff`, `patch`, `html`, `htm`, `http`, `js`, `json`, `jsx`, `less`, `md`, `php`, `phtml`, `php3`, `php4`, `php5`, `php7`, `phps`, `scss`, `sass`, `sh`, `bash`, `sql`, `svg`, `xml`, `yml`, `yaml`, `txt`. Props westonruter, georgestephanis, obenland, melchoyce, pixolin, mizejewski, michelleweber, afercia, grahamarmfield, samikeijonen, rianrietveld, iseulde. See #38707. Fixes #12423, #39892. git-svn-id: https://develop.svn.wordpress.org/trunk@41376 602fd350-edb4-49c9-b593-d223f7449a82
* Add `wp.hooks` - JavaScript actions and filters.Adam Silverstein2017-09-12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | Add a JavaScript hooks library with an API that mirrors the WordPress Plugin API; provides similar functionality and API to PHP hooks. Called via the global `wp.hooks`, eg: `wp.hooks.addAction()`, etc. Adds: * `addAction( 'hook', 'vendor/plugin/function', callback, priority )` * `addFilter( 'hook', 'vendor/plugin/function', callback, priority )` * `removeAction( 'hook', 'vendor/plugin/function' )` * `removeFilter( 'hook', 'vendor/plugin/function' )` * `removeAllActions( 'hook' )` * `removeAllFilters( 'hook' )` * `doAction( 'hook', arg1, arg2, moreArgs, finalArg )` * `applyFilters( 'hook', content, arg1, arg2, moreArgs, finalArg )` * `doingAction( 'hook' )` * `doingFilter( 'hook' )` * `didAction( 'hook' )` * `didFilter( 'hook' )` * `hasAction( 'hook' )` * `hasFilter( 'hook' )` Props adamsilverstein, jnylen0, aduth, kadamwhite, youknowriad, schlessera, mikeschinkel, azaozz, vhauri, CaptainN, scribu, carldanley, chetanchauhan, mgibbs189, stephenharris, justnorris, koopersmith, gcorne, TV productions, atimmer. Fixes #21170. git-svn-id: https://develop.svn.wordpress.org/trunk@41375 602fd350-edb4-49c9-b593-d223f7449a82