Matt Westcott
8e00fbb13c
StreamField block deletion
2021-03-17 23:32:31 +00:00
Matt Westcott
43a63d5567
Add type checks to telepath tests
2021-03-17 23:32:31 +00:00
Matt Westcott
31012506bd
Move telepath.js to utils
2021-03-17 23:32:30 +00:00
Matt Westcott
e651c1cdbd
Avoid creating references for trivial primitive values and short strings
2021-03-17 23:32:30 +00:00
Matt Westcott
cd50b842dc
Support unpacking of references
2021-03-17 23:32:30 +00:00
Matt Westcott
6111d66728
Add tests for telepath client
2021-03-17 23:32:30 +00:00
Matt Westcott
19cfd7a423
Move telepath module to components
2021-03-17 23:32:29 +00:00
Matt Westcott
7c53261d16
lint fix for blocks.js
2021-03-17 23:32:29 +00:00
Matt Westcott
323f9bc2d2
Assign ids to nodes that are referenced multiple times
2021-03-17 23:32:29 +00:00
Matt Westcott
99258f2a72
Introduce a two-pass mechanism for packing
...
Traversing the object structure with ValueContext.pack yields a tree of Node objects, on which we can call emit() to obtain the final JSONish representation. The nodes in this intermediate tree representation can be annotated to control the output, e.g. to indicate that it should be output with an ID attached.
2021-03-17 23:32:28 +00:00
Matt Westcott
1d815f7653
Foundation for reference-counting support
...
Move the packing logic into a one-shot ValueContext where we can stash previously-encountered sub-values for the current value being packed.
2021-03-17 23:32:28 +00:00
Matt Westcott
82dc18b24f
add unit tests for telepath
2021-03-17 23:32:28 +00:00
Matt Westcott
38548f1257
add slide animation on block addition
2021-03-17 23:32:27 +00:00
Matt Westcott
2845c218c2
Focus form field on addition, and show menu for initially-empty streams
2021-03-17 23:32:27 +00:00
Matt Westcott
a9cb60c44e
Close menu after selecting
...
Turns out we need to insert the new block *after* the active menu for the animation to work...
2021-03-17 23:32:27 +00:00
Matt Westcott
ebf249f685
use a dedicated counter for prefixes, not index
2021-03-17 23:32:27 +00:00
Matt Westcott
b78b908251
Hook up onclick handler for menu
2021-03-17 23:32:26 +00:00
Matt Westcott
e310cff2dd
Replace StreamBlock.append with an insert method that works on arbitrary indexes
2021-03-17 23:32:26 +00:00
Matt Westcott
a58439a9af
Pass initial 'new child' states to block types that need to dynamically create children
2021-03-17 23:32:26 +00:00
Matt Westcott
50d168f280
Ensure StructBlock.get_default properly reflects child block defaults
...
StructBlock previously handled default values 'lazily' at render time, setting meta.default to fall back to an empty dict and calling the child block's get_default on missing items. We can't do this with client-side rendering because get_default isn't available on the client-side block definition (and adding it to the client-side block API would introduce unnecessary bloat). Instead, we fix StructBlock.get_default to correctly pick up the defaults from its child blocks, so that anything that makes use of StructBlock.get_default (e.g. a containing ListBlock / StreamBlock that needs to create StructBlock children on the fly) will have the full accurate data to hand.
2021-03-17 23:32:26 +00:00
Matt Westcott
cf35306e64
Insert menus between blocks
2021-03-17 23:32:25 +00:00
Matt Westcott
00bfff1312
Construct StreamBlock menu
2021-03-17 23:32:25 +00:00
Matt Westcott
8cc2818922
Remove redundant duplicate calls to jQuery
2021-03-17 23:32:25 +00:00
Matt Westcott
e9d278e16e
Pass StreamBlock children as a grouped list
2021-03-17 23:32:24 +00:00
Matt Westcott
b9cb68e311
Refactor a StreamChild class out of StreamBlock
2021-03-17 23:32:24 +00:00
Matt Westcott
d7c1579a52
More specific exception for unpackable objects
2021-03-17 23:32:24 +00:00
Matt Westcott
d18d23190d
Update telepath JS code for new transport format
2021-03-17 23:32:24 +00:00
Matt Westcott
d4dc02ad0f
Rewrite wagtail.core.telepath to recursively pack constructor args
...
js_args and get_media methods no longer receive the context object, since they are not responsible for packing their own arguments.
2021-03-17 23:32:23 +00:00
Matt Westcott
ac0c5d7ef5
Add telepath adapter for snippet chooser
2021-03-17 23:32:23 +00:00
Matt Westcott
61dc5fb07f
Add telepath adapter for document chooser
2021-03-17 23:32:23 +00:00
Matt Westcott
950ef65056
Add telepath adapter for image chooser
2021-03-17 23:32:22 +00:00
Matt Westcott
3a6fb6f2b4
Have PageChooserAdapter inherit from WidgetAdapter so that we don't have to redefine media
2021-03-17 23:32:22 +00:00
Karl Hobley
14423d3fda
Add telepath widget for Draftail
2021-03-17 23:32:22 +00:00
Karl Hobley
3d59778f7a
Make WidgetAdapter pass through widget media
2021-03-17 23:32:22 +00:00
Karl Hobley
5fa50ad04a
Add classes to field blocks
2021-03-17 23:32:21 +00:00
Karl Hobley
7ae32e39f7
Implement autosize text input
2021-03-17 23:32:21 +00:00
Matt Westcott
20bc76bf10
Support passing initial state to widget.render
2021-03-17 23:32:21 +00:00
Matt Westcott
74b91f1ad6
Allow passing initial state to block.render and avoid reliance on setState
2021-03-17 23:32:20 +00:00
Matt Westcott
5714a6f9a0
Reorganise telepath/blocks.js so that block instances (aka bound blocks) have a proper class rather than closure-hacking
2021-03-17 23:32:20 +00:00
Matt Westcott
ce76f1a423
lint telepath/blocks.js
2021-03-17 23:32:20 +00:00
Matt Westcott
c0e6da5282
Add telepath adapter for PageChooser widget
2021-03-17 23:32:20 +00:00
Matt Westcott
c0c13e73d2
Remove erroneous static declaration on boundWidgetClass
2021-03-17 23:32:19 +00:00
Karl Hobley
2ba9619ed2
Linting telepath JS
2021-03-17 23:32:19 +00:00
Matt Westcott
ba7f94e604
remove temporary import of StructValue
2021-03-17 23:32:19 +00:00
Matt Westcott
839a13da22
Fix assignment of prefixes to children of ListBlock / StructBlock
2021-03-17 23:32:18 +00:00
Matt Westcott
00db3e791c
Implement a Telepath adapter for StreamBlock
2021-03-17 23:32:18 +00:00
Matt Westcott
a537510764
Remove placeholders for html text / error messages, as they just get in the way and we'll have to implement them properly later either way
2021-03-17 23:32:18 +00:00
Matt Westcott
b74ae40781
Implement adapter for ListBlock
2021-03-17 23:32:18 +00:00
Matt Westcott
99c6a4d77e
Add missing versioned_static
2021-03-17 23:32:17 +00:00
Matt Westcott
fbe08f02f5
Implement a get_form_state method for converting native block values to form-renderable ones
2021-03-17 23:32:17 +00:00