0
0
mirror of https://github.com/wagtail/wagtail.git synced 2024-11-25 13:10:14 +01:00
Commit Graph

426 Commits

Author SHA1 Message Date
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
54ce2f067f Remove 'SHOW_RESOLVED_COMMENTS' string 2021-04-20 18:25:30 +01:00
jacobtoppm
a482cf2cea Make comments output themselves in a formset in the edit view 2021-04-20 18:25:30 +01:00
jacobtoppm
a7a92a3106 Load comments from database to frontend. Ensure annotations are shown correctly by removing u-hidden class 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
7a741d770f Fix draftail focus test to use a fake timer 2021-04-20 09:46:45 +01:00
Matt Westcott
f26f65a755 Convert NodeList to array before running forEach
Makes it work on IE11. Fix borrowed from https://github.com/wagtail/wagtail/pull/6109/files#r435561917
2021-04-20 09:46:45 +01:00
Matt Westcott
b1c8142181 Delay focus on draftail widget for 50ms
This avoids an IndexSizeError on IE11 https://github.com/wagtail/wagtail/pull/6968#issuecomment-822591161 , apparently due to the focus triggering a field update before it has been fully initialised.
2021-04-20 09:46:45 +01:00
Scott Cranfill
42ddd8ad55
Apply chevron padding fix to all applicable select elements (#6980)
Co-authored-by: Thibaud Colas <thibaudcolas@gmail.com>
2021-04-16 21:02:36 +01:00
Storm Heg
e7942a05ad
Choosers: refactor to use SVG icons (#6998)
* Choosers: refactor to use SVG icons

Refactored non-deprecated choosers to use SVG icons. Custom choosers can
also supply their own svg icons using the `chosen_icon` and
`unchosen_icon` blocks.

We are keeping the relevant icon font css for custom choosers around to
prevent breaking existing custom choosers.

Co-authored-by: Thibaud Colas <thibaudcolas@gmail.com>
2021-04-16 15:43:13 +01:00
Karl Hobley
46f4c935d8 Add switch widget 2021-04-07 09:10:12 +01:00
Karl Hobley
e973c3d544 Add a faint grey background on unfocused block headers 2021-04-01 17:26:36 +01:00
Matt Westcott
eb18d37986 Implement getTextLabel on chooser widgets 2021-03-29 13:42:00 +01:00
Matt Westcott
0fa8508232 Implement getTextLabel on draftail widget 2021-03-29 13:41:53 +01:00
Matt Westcott
b219b60f95 Extract text labels from blocks to use in collapsed view 2021-03-29 13:41:39 +01:00
Matt Westcott
813621840c Make sequence children collapsible 2021-03-29 13:41:24 +01:00
Karl Hobley
47b9c040ec Update React Redux to 7.2.2 2021-03-19 17:10:57 +00:00
Matt Westcott
ee71bd3d07 Add 'disabled' styles for streamfield controls
Follows on from #6802 and #6799.
2021-03-17 23:32:59 +00:00
Matt Westcott
d3e58f7908 Delay slidedown animation to fix layout
Without this, the animation expands from somewhere in the middle of the block
2021-03-17 23:32:59 +00:00
Matt Westcott
f18a15e142 Animate ListBlock / StreamBlock insertion controls on insert/delete
This reduces the jumpiness on insertion and deletion. For nested sequences, it's not possible to eliminate the jump entirely without editing the CSS, because the insert button is `display: inline-block` which gives it a minimum height of the containing block's line-height - as a result, this spacing appears immediately as soon as the block changes from display:none to visible.
2021-03-17 23:32:59 +00:00
Matt Westcott
7361b0901f Make animation an explicit flag on deleteBlock / duplicateBlock (and test in non-animated mode) 2021-03-17 23:32:58 +00:00
Matt Westcott
773da59107 Update lint comments for typescript-eslint 2021-03-17 23:32:58 +00:00
Matt Westcott
d5c174e027 Don't focus date pickers when adding new blocks
While focusing on the first child field of a new block is generally a good thing, focusing a date field opens the date picker, which looks clunky when you've not explicitly requested it. Introduce a 'soft' focus flag to indicate that we only want to focus the field if it can be done unobtrusively.
2021-03-17 23:32:58 +00:00
Karl Hobley
ca3d6df80f Telepath: Catch JavaScript errors from widget rendering 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
Matt Westcott
a5a33db3ff stylelint fix 2021-03-17 23:32:55 +00:00
Karl Hobley
9df8b3cad8 Merge Wagtail customisations into Streamfield SCSS 2021-03-17 23:32:55 +00:00
Karl Hobley
caf8a7f2d7 Import SCSS from react-streamfield 2021-03-17 23:32:54 +00:00
Karl Hobley
0360cf4c2f Telepath: Validation of block counts 2021-03-17 23:32:54 +00:00
Matt Westcott
4ee65760fe Add BaseSequenceBlock superclass 2021-03-17 23:32:54 +00:00
Matt Westcott
320c639255 standardise on 'inserter' as the catch-all name for insertPosition / menu
it's probably going to end up as part of the public api (so we can do myStreamBlock.inserters[0].open()), so best to give it a suitably snappy name
2021-03-17 23:32:53 +00:00
Matt Westcott
10abdd5a4b Make _onRequestInsert methods match 2021-03-17 23:32:53 +00:00
Matt Westcott
570780f38c Introduce a low-level _insert method used by the onRequestInsert handler
This method will be suitable for pulling out into a common superclass. Having matching method signatures for ListBlock._insert and StreamBlock_insert means that the glue code for handling onRequestInsert can be shared, while the public insert methods of ListBlock and StreamBlock remain distinct (because having to pass a block type / definition to ListBlock.insert would be a pretty bad public API).
2021-03-17 23:32:53 +00:00
Matt Westcott
490529d0b1 Pull out _createChild / _createInsertionControl methods from insert
This starts to make the insert logic generic, and irons out the awkwardness of having to pass groupedChildBlockDefs as an extra option on StreamBlockMenu
2021-03-17 23:32:53 +00:00
Matt Westcott
8d63599552 Add a shared superclass for StreamBlockMenu and InsertPosition 2021-03-17 23:32:52 +00:00
Matt Westcott
88b5c4966d Standardise on onRequestInsert as callback for inserting blocks
This makes it generic to both StreamBlock and ListBlock: the callback passes an index number and a dict of container-specific options (empty for ListBlock, and a 'type' option for StreamBlock)
2021-03-17 23:32:52 +00:00
Matt Westcott
35b3650c71 Remove isOpen flag from StreamBlockMenu constructor
The "initial menu for an empty stream is initially open" business rule is implemented elsewhere, in StreamBlock.setState, so this is redundant in the constructor - and it will get in the way of sharing implementation with ListBlock, because the equivalent control for ListBlock (i.e. the Add button) doesn't have a concept of open-ness.
2021-03-17 23:32:52 +00:00
Matt Westcott
0e96693fde Clear out obsolete templates / js from pre-telepath streamfield 2021-03-17 23:32:52 +00:00
Karl Hobley
599365752f Telepath: Duplication of items within StreamBlock and ListBlock 2021-03-17 23:32:51 +00:00
Karl Hobley
040a9c2db1 Telepath: Implement random insert for list blocks 2021-03-17 23:32:51 +00:00
Karl Hobley
ab8eaf69fd Add insert buttons between each list item 2021-03-17 23:32:51 +00:00
Karl Hobley
c101fcbb75 Telepath: Animate new list block items 2021-03-17 23:32:50 +00:00
Matt Westcott
44d23ca099 Localise the Add string 2021-03-17 23:32:50 +00:00
Matt Westcott
b766be2db6 Escape HTML in interpolated strings 2021-03-17 23:32:50 +00:00
Karl Hobley
2e55191a75 Telepath: StaticBlock 2021-03-17 23:32:50 +00:00
Matt Westcott
dac71cd4a7 Pass translation strings for list/stream buttons to JS 2021-03-17 23:32:47 +00:00
Matt Westcott
dac969a372 Test reordering 2021-03-17 23:32:46 +00:00
Matt Westcott
9f82264b33 Implement ordering controls on ListBlock 2021-03-17 23:32:46 +00:00
Matt Westcott
f96c567353 Implement ordering controls on StreamBlock 2021-03-17 23:32:46 +00:00