0
0
mirror of https://github.com/wagtail/wagtail.git synced 2024-11-29 17:36:49 +01:00
Commit Graph

154 Commits

Author SHA1 Message Date
Jacob Topp-Mugglestone
7f528e7c93 Feature/redux comments (#6856)
Adds inline commenting to the Draftail editor (FE only), and refactors field level comments to subscribe to updates from the store directly



* Refactor field level comments to subscribe to updates directly from the commenting store, rather than calling methods on supplied widgets and annotations directly from the commenting app

* Update Draftail and React-Redux packages in preparation for Draftail inline commenting

* Add CommentableEditor version of Draftail as controlled component, in preparation for manipulating state from the comments system

* Only initialize CommentableEditor if comments are on and the contentpath is valid. Add a comment-adding control to CommentableEditor

* Update eslint

* Remove comment adding control from Draftail if comments are disabled

* fixup! Only initialize CommentableEditor if comments are on and the contentpath is valid. Add a comment-adding control to CommentableEditor

* Add decorator to comments, allowing them to be focused

* Add inline styling to comments

* Make Draftail instance accessible via the DOM node on CommentableEditor as well

* Force rerender for styles and decorators when necessary, and filter out deleted comments

* Remove comment styles when saving Draftail content

* Fix formatting error

* Remove unnecessary comment

* Don't use addition for string concatenation

* Newline

* Add explanatory comment about save logic

* fixup! Don't use addition for string concatenation

* Use more idiomatic undefined check

* Fix aria-label for comment button

* Use span to decorate link

Co-authored-by: Thibaud Colas <thibaudcolas@gmail.com>

* Update getFullSelectionState comment

Co-authored-by: Thibaud Colas <thibaudcolas@gmail.com>

* Reorder selection state generation

Co-authored-by: Thibaud Colas <thibaudcolas@gmail.com>

* Remove unused argument

Co-authored-by: Thibaud Colas <thibaudcolas@gmail.com>

* Make draftail position comments by median annotation, and pin by clicked comment

* Remove inline return

* Make setPinnedComment an option on setFocusedComment

* Add JSDoc comments and remove unused attribute

* use decoratorRef instead of Ref for clarity in annotation

* fixup! Update eslint

* Update Draftail snapshot

* Move entrypoint

* Prettier reformat and eslint fix

* Use Typescript for CommentableEditor

* Install types for react-redux and draft-js

* Remove unused popPage from interface

* Add draftjs-filters as an explicit dependency

* fixup! Use Typescript for CommentableEditor

* Add explicit type for timeout

Co-authored-by: Thibaud Colas <thibaudcolas@gmail.com>
2021-04-20 18:25:30 +01:00
Jacob Topp-Mugglestone
2ab917bc92 Feature/field comment frontend (#6530)
* Initial working version of comment frontend in edit view

* Make comment js text translatable

* Add comment icon

* Basic hardcoded comment adding widget

* Create widget object and register it with the comment app to subscribe to updates about related annotations and whether comments are shown

* Add data-contentpath attributes to field (and data-contentpath-disabled to fields which prevent a stable contentpath existing at this point - ie ListBlock block positions are not uniquely identified), and to ensure newly generated streamfield blocks also have a stable contentpath identifiable from the frontend, make streamfield uuids generate clientside

* Make comments detect new contentpaths, and move hardcoded comment widget on chooser template into js initialisation, also making new comment buttons init properly in new streamfield blocks

* Fix tests to expect contentpaths

* Remove two step comment widget initialisation, and replace with stored callbacks for widgets that try to initialise themselves before the comment app itself. Refactor widgets to receive the makeComment function directly from the commenting system via an onRegister method to accommodate this

* Use object argument instead of positional for FieldLevelCommentWidget constructor

* Use json_script to pass author to the comments system
2021-04-20 18:25:30 +01:00
Matt Westcott
10d106ab43 Upgrade telepath to 0.0.3 for ES5 compatibility 2021-04-14 20:58:40 +01:00
Karl Hobley
47b9c040ec Update React Redux to 7.2.2 2021-03-19 17:10:57 +00:00
Karl Hobley
7b0d671100 Update React to 16.14 2021-03-19 14:01:50 +00:00
Matt Westcott
30fee96d37 update telepath-unpack to 0.0.2 to fix module imports 2021-03-17 23:32:57 +00:00
Matt Westcott
31a6e5b0a8 Move telepath.js into an external package 2021-03-17 23:32:56 +00:00
Karl Hobley
caf8a7f2d7 Import SCSS from react-streamfield 2021-03-17 23:32:54 +00:00
Karl Hobley
2ba9619ed2 Linting telepath JS 2021-03-17 23:32:19 +00:00
Thibaud Colas
fd563b6adf
Use TypeScript configuration for all JS linting (#6862)
- Switches our JS linting to be done with the TypeScript parser, and TypeScript rules. They handle JavaScript as well, and using the same parser everywhere matches how our build tools work. Additionally I had to disable a few rules for test files and webpack.config.js.
- Adds --report-unused-disable-directives to our linting script, and removes the unused directives.
2021-03-05 16:54:11 +00:00
Joshua Marantz
8e79c61564
Implement CSS variables for admin color theming (#6409)
Co-authored-by: JNaftali <jmarantz@thelabnyc.com>
Co-authored-by: Thibaud Colas <thibaudcolas@gmail.com>
2021-01-17 02:17:41 +00:00
Karl Hobley
773de3eded Update webpack to version 5 2021-01-15 17:13:39 +00:00
Karl Hobley
9873c23e3c Manually fix/ignore remaining legacy JS linting issues 2020-12-22 23:39:24 +00:00
Karl Hobley
650045b573 Convert Explorer into TypeScript
And replace PropTypes with TypeScript annotations
2020-10-21 23:33:51 +10:00
Thibaud Colas
d316677b89 Switch from Babel to TypeScript 2020-10-21 12:48:40 +01:00
Thibaud Colas
e2bfeb1e20 Fix remaining reported vulnerabilities 2020-10-21 12:33:25 +01:00
Thibaud Colas
5392891c5a Upgrade to latest @wagtail/stylelint-config-wagtail to remove peerDependency warning 2020-10-21 12:33:25 +01:00
Thibaud Colas
582b9c61fd Replace gulp-cssnano and gulp-autoprefixer with gulp-postcss and respective packages 2020-10-21 12:33:25 +01:00
Thibaud Colas
d0dd6820c9 Update Webpack 2020-10-21 12:33:25 +01:00
Karl Hobley
3e158ca2aa
Enable TypeScript (#6472)
Co-authored-by: Thibaud Colas <thibaudcolas@gmail.com>
2020-10-21 00:51:09 +01:00
Karl Hobley
0c2bae7941
Update to Babel 7 (#6471)
Co-authored-by: Thibaud Colas <thibaudcolas@gmail.com>
2020-10-20 17:06:52 +01:00
Thibaud Colas
100edcdc09 Update npm dependencies with npm audit fix
Apply trickier gulp upgrades

Update react-streamfield, removing extraneous dependency

Upgrade to latest version of stylelint

Add package-lock.json changes from local npm install
2020-06-04 07:02:43 +10:00
Thibaud Colas
314a926f75 Update Python and JS test coverage collection to exclude tests 2020-05-27 09:11:26 +01:00
Thibaud Colas
7eeb44ad04 Replace gulp-sass with gulp-dart-sass
* Rewrite Sass code that relies on deprecated or removed features in Dart Sass
* Remove unneeded rebuild of node-sass
* Update lockfile
2020-05-17 21:00:20 +10:00
Thibaud Colas
471823f238 Upgrade to Jest 23
* Jest 24 is out but upgrading to it would require us to also update our Webpack tooling to Babel 7, which is quite significant work.
* Rewrite Draftail initialisation tests to stop relying on jsdom script parsing
2020-05-17 20:35:00 +10:00
Jim Jazwiecki
6ea0cc52f3 Upgrade to Gulp v4 & Node 10
* Syntax changes to get Gulp working
* Require Node 10, use node 10 in CircleCI and squash.yml
* Update docs
* resolves #5653
2020-05-01 12:01:03 +10:00
dependabot[bot]
01caaa0dc2 Bump eslint from 2.13.1 to 4.18.2 (#5665)
* Bump eslint from 2.13.1 to 4.18.2

Bumps [eslint](https://github.com/eslint/eslint) from 2.13.1 to 4.18.2.
- [Release notes](https://github.com/eslint/eslint/releases)
- [Changelog](https://github.com/eslint/eslint/blob/master/CHANGELOG.md)
- [Commits](https://github.com/eslint/eslint/compare/v2.13.1...v4.18.2)

Signed-off-by: dependabot[bot] <support@github.com>

* fix up linting issues
2019-11-06 18:16:10 +00:00
Bertrand Bordage
1a4c157ec8 Updates to react-streamfield 0.9.5. 2019-08-23 14:55:27 +01:00
Matt Westcott
725b01c809 Replace streamfield CSS with react-streamfield CSS 2019-08-23 14:55:26 +01:00
LB Johnston
bbbb70ae65 Remove explicit stylelint-scss requirement & upgrade config pkg to v0.1.0 2019-05-20 16:42:35 +01:00
LB Johnston
3271d91237 Revise npm run lint to also lint scss files 2019-05-20 16:42:35 +01:00
LB Johnston
adc4767eec Install @wagtail/stylelint-config-wagtail & upgrade stylelint packages 2019-05-20 16:42:35 +01:00
Thibaud Colas
7b417681cd Set up react-axe to report accessibility issues automatically while developing 2019-04-29 13:55:41 +01:00
Thibaud Colas
f987fa91c9
Upgrade Draftail to v1.2.1. Fix #4985, adds more Markdown shortcuts (#5117)
This includes:

- [v1.0.0](https://github.com/springload/draftail/releases/tag/v1.0.0) (identical to v0.17.2)
- [v1.1.0](https://github.com/springload/draftail/releases/tag/v1.1.0) (contains fix for #4985)
- [v1.2.0](https://github.com/springload/draftail/releases/tag/v1.2.0)
- [v1.2.1](https://github.com/springload/draftail/releases/tag/v1.2.1) (fixes regression in v1.2.0)

Here is the combined CHANGELOG for what's relevant to Wagtail:

Bug fixes
~~~~~~~~~

- #4985 – Prevent crash when filtering pasted content whose last block is to be removed (e.g. unsupported image) ([#179](https://github.com/springload/draftail/issues/179)).
- Stop unnecessarily calling `onSave` in the editor’s `onBlur` ([#173](https://github.com/springload/draftail/issues/173)).
- Prevent crash in `DraftUtils.getEntitySelection`, when the provided entity key isn't valid (undefined, missing) ([#168](https://github.com/springload/draftail/pull/168)).
- Fix entity removal and editing not doing anything when the selection is backwards (right to left) ([#168](https://github.com/springload/draftail/pull/168)).
- Prevent the editor from crashing when copy-paste filtering removes all of its content (https://github.com/thibaudcolas/draftjs-filters/commit/652750f)

New features
~~~~~~~~~~~~

- Add support for Markdown shortcuts for inline styles, e.g. `**` for bold, `_` for italic, etc ([#134](https://github.com/springload/draftail/issues/134), [#187](https://github.com/springload/draftail/pull/187)). View the full list of [keyboard shortcuts](https://www.draftail.org/docs/keyboard-shortcuts).

New APIs
~~~~~~~~

- Add [`onFocus`](https://www.draftail.org/docs/api#managing-focus) and [`onBlur`](https://www.draftail.org/docs/api#managing-focus) props to use callbacks on those events. This can be useful for [form validation](https://www.draftail.org/docs/next/form-validation). [#170](https://github.com/springload/draftail/issues/170), [#174](https://github.com/springload/draftail/pull/174), thanks to [@TheSpicyMeatball](https://github.com/TheSpicyMeatball).
- Add [`plugins`](https://www.draftail.org/docs/plugins) API to support extensions of the editor using the [draft-js-plugins](https://github.com/draft-js-plugins/draft-js-plugins) architecture ([#83](https://github.com/springload/draftail/issues/83), [#171](https://github.com/springload/draftail/pull/171)).
- Add ability to disable or customise the editor toolbar with [`topToolbar`](https://www.draftail.org/docs/customising-toolbars).
- Add ability to add a toolbar below the editor with [`bottomToolbar`](https://www.draftail.org/docs/customising-toolbars).
- Add data reset parameter to `DraftUtils.resetBlockWithType()`.
- Enable list continuation on Enter for custom `*-list-item` blocks. All that’s required is for the block type to end with `-list-item`.

None of those API additions will be usable within Wagtail (at least without hacks) until corresponding rich text features APIs are built to allow their configuration. The last 2 additions would already be usable but they would only be useful when leveraging the other APIs.
2019-03-21 20:29:26 +00:00
Janneke Janssen
80ef9554bc Update npm-run-all due to its flatmap-stream and event-stream vulnerabilities (#4930) 2018-11-28 11:35:21 +00:00
Thibaud Colas
6301eb4b75 Remove unused devDependency 2018-10-10 14:02:29 +01:00
Thibaud Colas
ad5a3bbdc2 Remove unused React component generator 2018-10-10 14:02:29 +01:00
Matt Westcott
1478d324d1 Security audit of npm packages (#4709)
* Upgrade gulp-sass to 4.0.1 and rebuild package-lock.json with npm 6

The only difference to the generated code appears to be in sourcemap data.

* Run npm audit to fix most vulnerable packages

Generated static files are unchanged by this update.

* Revert package-lock.json to npm 5 format
2018-08-08 01:43:58 +03:00
Thibaud Colas
bb14ba2ced Revert "Upgrade gulp-sass to 4.0.1 and rebuild package-lock.json with npm 6"
This reverts commit 497207735a.
2018-07-31 23:53:05 +03:00
Thibaud Colas
7ba4c448f3 Revert "Run npm audit to fix most vulnerable packages"
This reverts commit f283c8bcdd.
2018-07-31 23:52:51 +03:00
Matt Westcott
f283c8bcdd Run npm audit to fix most vulnerable packages
Generated static files are unchanged by this update.
2018-07-31 23:48:57 +03:00
Matt Westcott
497207735a Upgrade gulp-sass to 4.0.1 and rebuild package-lock.json with npm 6
The only difference to the generated code appears to be in sourcemap data.
2018-07-31 23:48:57 +03:00
Thibaud Colas
b92847cacf Upgrade Draftail to latest, fixing copy-paste between editors losing formatting/content. Fixes #4432 2018-06-14 11:29:57 +01:00
Thibaud Colas
53f015b318 Upgrade Draftail to v0.17.1. (#4426) 2018-03-27 22:33:25 +02:00
Thibaud Colas
87b0a89e1e Upgrade Draftail to latest release, addressing #4296 2018-02-27 15:48:34 +00:00
Thibaud Colas
9861c2a0d4 Move Draftail tooltips portal closer to the editor to prevent background flickering 2018-02-12 21:54:08 +00:00
Thibaud Colas
cedfd2b1bc Update to latest Draftail and Draft.js 2018-02-09 15:24:24 +00:00
Thibaud Colas
8c21b77e1c Update to latest Draftail 2018-01-26 12:58:11 +02:00
Thibaud Colas
f939dd2356 Pin draft-js dependency to v0.10.4 for now 2018-01-24 17:37:57 +02:00
Thibaud Colas
259dcc1f16 Prevent Jest from running tests in build directory 2018-01-19 18:02:49 +02:00
Thibaud Colas
efb3768871 Update to latest Draftail 2018-01-18 18:32:15 +02:00
Thibaud Colas
8742b249f3 Update to latest Draftail 2018-01-18 18:32:15 +02:00
Thibaud Colas
61a57b6691 Add babel plugin to remove prop-types in production, shave off some kBs 2018-01-18 00:02:04 +02:00
Thibaud Colas
792538b942 Expose React-related dependencies as global variables for extension 2018-01-17 23:23:17 +02:00
Thibaud Colas
f50ce2b19e Remove unused lodash dependencies 2018-01-17 22:21:30 +02:00
Thibaud Colas
1eb38a8b7c Replace object-assign and promise polyfills with core-js 2018-01-17 22:19:37 +02:00
Thibaud Colas
3f7583c9c6 Update Draftail to latest 2018-01-17 22:17:14 +02:00
Thibaud Colas
9c5c116b04 Update to Draftail 0.11.0 2018-01-17 22:16:35 +02:00
Thibaud Colas
a741f3b7a6 Update to latest Draftail 2018-01-17 22:01:40 +02:00
Thibaud Colas
00009252ac Add Draftail and Draft.js to dependencies 2018-01-17 21:59:31 +02:00
Janneke Janssen
28dd28187a Update React and related dependencies to latest versions
Updated snapshots due to the upgrade and failing ExplorerPanel test. This was due to the shallow call being made earlier than defining the document.body
Update to React 16
Update other dependencies
Stylelint updates
Remove unused imports
Update babel and gulp packages
Update package-lock
2018-01-17 21:48:17 +02:00
Janneke Janssen
b3e126d6b9 Update React to 15.6.2 due to relicensing (#3884) 2017-09-29 18:18:16 +13:00
Mikalai Radchuk
32846db1cb Use npm-run-all in npm scripts
This should allow us to run NPM scripts on Windows
2017-09-20 16:22:37 +01:00
Mikalai Radchuk
dd3ad857de Install npm-run-all 2017-09-20 16:22:37 +01:00
Vincent Audebert
a10e1f0761 Add CSS minification and source maps for Sass 2017-08-27 20:25:53 +02:00
Anselm Bradford
a900965fba Fixes #3516 - replaces scss-lint with stylelint 2017-08-26 16:39:45 +03:00
Thibaud Colas
65e6c6920f Add npm run lint:css command to run Sass linting 2017-08-11 16:26:11 +01:00
Thibaud Colas
cee40964cb Stop pinning exact dependency 2017-08-11 15:40:43 +01:00
Thibaud Colas
80cbef5b78 Stop using require-dir 2017-08-11 15:40:43 +01:00
Thibaud Colas
76c2ce3ad5 Bump dependencies to be Node 8 compatible 2017-08-11 15:40:43 +01:00
Thibaud Colas
aea1b76433 Remove unneeded engines property in package.json 2017-08-11 15:40:43 +01:00
Thibaud Colas
bdf00874bd Enable tree shaking via Webpack 2 2017-06-14 13:47:53 +02:00
Thibaud Colas
6cfd139cc2 Inline util from redux-actions to reduce bundle size 2017-06-09 16:43:50 +03:00
Thibaud Colas
e64903659e Remove unused react-addons-test-utils 2017-06-09 16:43:50 +03:00
Thibaud Colas
fea537566f Remove unused Webpack loaders and babel-cli 2017-06-09 16:42:48 +03:00
Thibaud Colas
b4f8e09e43 Replace babel-polyfill with more lightweight polyfills 2017-06-09 16:42:48 +03:00
Thibaud Colas
53923397cc Move Babel config to package.json 2017-06-09 16:42:48 +03:00
Thibaud Colas
f75fa0a880 Use portable sub-directory install npm command 2017-06-09 16:42:48 +03:00
Thibaud Colas
d2a62f7277 Remove useless browserify config from package.json 2017-06-09 16:42:48 +03:00
Thibaud Colas
61b6de2e4e Tidy up new React + API explorer for mobile (fixes #3607) (#3635)
* Remove useless CSS declaration

* Remove commented out styles

* Merge duplicate declarations

* Remove even more commented out code

* Move footer mq to footer declaration

* Remove more useless code

* Stop vendor prefixing for IE below 11

* Remove useless vendor prefixing

* Merge identical declarations

* Fix 1px overflow in content wrapper

* Fix explorer scrolling when open on mobile

* Remove unused import

* Add Redux performance measurements to explorer menu

* Rewrite explorer reducer to avoid unnecessary operations

* Stop changing reducer state on every action regardless of type

* Remove redundant children.isFetching property in nodes reducer

* Remove redundant children.isLoaded property in nodes reducer

* Remove redundant children.isError property in nodes reducer

* Refactor nodes explorer reducer with sub-reducer

* Fix linting issue

* Remove unused class name

* Change default icon className from empty string to null

* Remove old TODO comment

* Hoist icons in ExplorerItem component for better performance

* Add comment

* Add tooling for performance measurement of React components

* Clean up explorer panel component definition

* Make performance measurements opt-in

* Improve alignment of page explorer menu on mobile

* Close explorer on touchend rather than touchstart

* Comment out performance measurement code

* Remove fade transition completely
2017-06-09 00:08:04 +03:00
Janneke Janssen
911567af4e Update Webpack to v2 (#3628)
* Update webpack and its dependencies
* Update base config to Webpack 2
2017-06-07 12:39:24 +03:00
Janneke Janssen
f4f0e78f6a Update React & Jest (#3611)
* Update to the latest jest version

* Update react dependencies

* Migrate React.PropTypes to PropTypes package

* Add prop-types to the package.json

* Update transition-group import to its new package

* Update jest snapshots

* Exclude node_modules from webpack babel-loader
2017-05-28 21:49:05 +03:00
Janneke Janssen
2ff4a5aad1 Update explorer for latest scope, UI, with tests 2017-05-13 23:53:10 +03:00
Rob Moorman
a0e4b0bafa Pin eslint-config-wagtail version
Pin eslint-config-wagtail version to prevent conflicts with minor rule changesets
2017-05-13 23:53:10 +03:00
Harris L
3f85c5fed5 Make explorer tab-navigable
* use focus-trap-react
* switch clickable span to button
* let focus trap handle outside click
2017-05-13 23:53:10 +03:00
Sævar Öfjörð Magnússon
81c6f3e3b1 Change explorer behavior for pages w/ children, with tests 2017-05-13 23:53:10 +03:00
Thibaud Colas
8bf2c9bf2e Refactor explorer code with tests using Jest 2017-05-13 23:53:10 +03:00
Josh Barr
d675807cf8 First version of the explorer on top of admin API 2017-05-13 23:53:10 +03:00
Janneke Janssen
493a30bcf9 Add nvmrc to the project and updated developing docs 2017-02-20 11:14:33 +01:00
Janneke Janssen
64bb8b2989 Move webpack configuration in subfolder of client/
Move webpack configuration to a subfolder in the client directory

Remove trailing whitespace

Rename prd.config.js to prod.config.js

Simplify lint:js target path
2017-01-26 01:16:04 +02:00
Matt Westcott
6f834c9a9b Update links to github.com/torchbox to point to github.com/wagtail 2016-12-15 11:49:49 +00:00
Matt Westcott
6b6866345e freeze NPM packages at a point in time when they actually appear to collectively work 2016-05-04 16:24:37 +01:00
Matt Westcott
5945ad8b28 upgrade gulp to 3.9.1 2016-05-03 21:50:45 +01:00
Matt Westcott
fcce9b8dc1 version-bump gulp-sass (the latest node-sass breaks compatibility with 2.0... I think) 2016-05-03 16:48:24 +01:00
Josh Barr
cf23387843 replace pushd with cd 2016-03-07 09:54:07 +00:00
justinvdm
7207e31784 Add missing dependencies to package.json 2016-02-25 17:34:15 +02:00
Josh Barr
14f02a0b50 Tooling for modern front-end components: React JS, ES6, and BEM CSS
Thanks to @justinvdm for the help

Merges: #2275
2016-02-25 13:32:48 +00:00
Dave Cranwell
fc980bd103 updated npm packages. ongoing linting of scss files 2015-11-23 21:39:54 +00:00
Matt Westcott
f6e6f9a909 Bump browserify to 3.46.1
3.36.0 depends (indirectly, via derequire 0.8.0) on esprima-six, which has disappeared from npm causing installation to fail. https://github.com/substack/node-browserify/pull/710
2015-11-14 02:36:25 +00:00
Denis Voskvitsov
4d04e73674 Update gulp-sass to 2.0.x 2015-10-21 12:19:24 +03:00