0
0
mirror of https://github.com/wagtail/wagtail.git synced 2024-12-01 11:41:20 +01:00
Commit Graph

11397 Commits

Author SHA1 Message Date
Karl Hobley
6e88b6c620 Fix new comments going to the top 2021-04-20 18:25:30 +01:00
Karl Hobley
0bb606a67d Hide buttons by default 2021-04-20 18:25:30 +01:00
Karl Hobley
5c8f8be904 Move comments toggle code into comments.js 2021-04-20 18:25:30 +01:00
Karl Hobley
1257816568 Add initCommentsInterface function 2021-04-20 18:25:30 +01:00
Karl Hobley
7411e278e0 Merge comments.js into entrypoint 2021-04-20 18:25:30 +01:00
Karl Hobley
d4ba41f770 Make commentApp a module global (rather than putting it on the window) 2021-04-20 18:25:30 +01:00
Karl Hobley
17f1798178 Implement commenting on field blocks 2021-04-20 18:25:30 +01:00
Karl Hobley
06d2e0daec Add comments at the field level rather than in each widget 2021-04-20 18:25:30 +01:00
Karl Hobley
2cbeed858f Dynamically resize fields when comments are enabled 2021-04-20 18:25:30 +01:00
Karl Hobley
03367519f6 Add a missing space 2021-04-20 18:25:30 +01:00
jacobtoppm
5c7c08fc0b Split out CommentableEditor utility functions, and add basic tests 2021-04-20 18:25:30 +01:00
Karl Hobley
99bccfdd57 Delete comments when block is deleted (#6957) 2021-04-20 18:25:30 +01:00
Jacob Topp-Mugglestone
9eedf30f70 Feature/inline comment focus on add (#6983)
* Use unfocus on mousedown for Draftail compatibility, and add comment adders to exceptions

* Focus comment on timeout to avoid losing focus to rerendering Draftail

* Stop editor from stealing focus, and add unfocus exception class to comment button

* Remove unused eslint disable

* Fix forwarded ref

* Remove unnecessary memo
2021-04-20 18:25:30 +01:00
Karl Hobley
99a65d3443 Separate layout calculations for each tab 2021-04-20 18:25:30 +01:00
Karl Hobley
c0588c1511 Only refresh comment positions on current tab
Prevents comments on other tabs moving to the top of the page
2021-04-20 18:25:30 +01:00
Karl Hobley
e2ee17bb59 Make comment app track which tab comments are on 2021-04-20 18:25:30 +01:00
Karl Hobley
576c30cbad Make commenting track which tab is currently active 2021-04-20 18:25:30 +01:00
Karl Hobley
e0d4381661 Add data attrs/events so that we can tell which tab is active 2021-04-20 18:25:30 +01:00
Karl Hobley
3aafb4e705 Commenting: Tweak the sizes to more closely match the design (#6978)
* Commenting: Tweak the sizes to more closely match the design

* Further UI tweaks

- Address feedback from review
- Add a TextArea component that dynamically expands

* Remove duplicate focusing logic

* Linting

* Revert "Remove duplicate focusing logic"

This reverts commit 340c965788.

* Remove textarea focus
2021-04-20 18:25:30 +01:00
Karl Hobley
a5624a3e09 Replace comment icon with comment-dots 2021-04-20 18:25:30 +01:00
Karl Hobley
3174ffee08 Add commenting controls 2021-04-20 18:25:30 +01:00
Jacob Topp-Mugglestone
779f50aa3c Draftail comment styling
* Add right hand alignment and teal colour to Draftail comment control

* Add css fix for empty comment styles

* Update comment highlight colours
2021-04-20 18:25:30 +01:00
Jacob Topp-Mugglestone
ebdb3efbe6 Feature/comment resolving (#6975)
* Prevent deleted comments being undeleted when the page form is invalid

* Add resolved state for comments
2021-04-20 18:25:30 +01:00
Jacob Topp-Mugglestone
d64dad9739 Add save warning to page editor for comments and edits 2021-04-20 18:25:30 +01:00
Karl Hobley
c619261565 Fix icons in comments 2021-04-20 18:25:30 +01:00
Karl Hobley
c9ebfab6f0 Delete topbar component 2021-04-20 18:25:30 +01:00
Karl Hobley
bbbc31ff60 Merge Wagtail Comment Frontend (#6953)
* Copy code from wagtail-comment-frontend

Exact copy of the src directory from:
4486c2fc32

* Integrate commenting code

* Linting
2021-04-20 18:25:30 +01:00
Karl Hobley
daada5b4c8 Add a couple more JS translation strings 2021-04-20 18:25:30 +01:00
Karl Hobley
673a5e7bd2 Add Avatar URLs into authors data 2021-04-20 18:25:30 +01:00
Karl Hobley
bd606ab15c Assign new block id on insert 2021-04-20 18:25:30 +01:00
Karl Hobley
f2d763909f Set data-contentpath on struct children 2021-04-20 18:25:30 +01:00
Karl Hobley
7d50943c01 Set data-contentpath on sequence children 2021-04-20 18:25:30 +01:00
jacobtoppm
4aa2753762 Install redux types 2021-04-20 18:25:30 +01:00
jacobtoppm
7aa9803636 Add BE logic for updating and outputting comment positions 2021-04-20 18:25:30 +01:00
jacobtoppm
f4192f2361 Break out position updating into separate function 2021-04-20 18:25:30 +01:00
jacobtoppm
495384ad26 Add comment position saving and loading from the database 2021-04-20 18:25:30 +01:00
jacobtoppm
211abd19bf Persist block key between Draftail blocks and database html. This will allow inline comment positions to be stable between revisions 2021-04-20 18:25:30 +01:00
jacobtoppm
c49d6a7572 Prevent copying of comments when copying pages 2021-04-20 18:25:30 +01:00
jacobtoppm
7907aff7ff Use CSS variables for comment highlight colours 2021-04-20 18:25:30 +01:00
jacobtoppm
90114c246b Reduce line lengths and add longer variable names 2021-04-20 18:25:30 +01:00
jacobtoppm
c6817cbb83 Remove use of magic number when retrieving comment ids 2021-04-20 18:25:30 +01:00
jacobtoppm
99b434c6f0 Prevent undo/redo from resurrecting invalid comment styles 2021-04-20 18:25:30 +01:00
jacobtoppm
73e41b34b0 Add logic to decorator, trying to ensure all reasonably added comments are clickable 2021-04-20 18:25:30 +01:00
jacobtoppm
5a9d5f6e4e Handle styling for overlapping comments, by using customStyleFn instead 2021-04-20 18:25:30 +01:00
jacobtoppm
3592aaba16 Don't decorate comment sections that overlap entities 2021-04-20 18:25:30 +01:00
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
ee5a147573 Add js translatable string for comment save warning (#6644) 2021-04-20 18:25:30 +01:00
jacobtoppm
198d65e5f7 Throw nicer error if comment element is missing and initialisation fails 2021-04-20 18:25:30 +01:00
jacobtoppm
11898a2606 Prefetch commenting users in one go 2021-04-20 18:25:30 +01:00
jacobtoppm
3e4eb8ae21 Replace apparent duplicate comments=[] in CommentPanel 2021-04-20 18:25:30 +01:00