Update to latest Draftail and Draft.js

pull/4261/head
Thibaud Colas 2018-02-09 11:23:04 +02:00 zatwierdzone przez Matt Westcott
rodzic e59863f903
commit cedfd2b1bc
5 zmienionych plików z 20 dodań i 54 usunięć

Wyświetl plik

@ -5,18 +5,7 @@ exports[`Document no data 1`] = `
contentState={
Immutable.Record {
"entityMap": Object {
"__add": [Function],
"__create": [Function],
"__get": [Function],
"__getLastCreatedEntityKey": [Function],
"__mergeData": [Function],
"__replaceData": [Function],
"add": [Function],
"create": [Function],
"get": [Function],
"getLastCreatedEntityKey": [Function],
"mergeData": [Function],
"replaceData": [Function],
"2": "2",
},
"blockMap": Immutable.OrderedMap {
"a": Immutable.Record {
@ -85,18 +74,7 @@ exports[`Document works 1`] = `
contentState={
Immutable.Record {
"entityMap": Object {
"__add": [Function],
"__create": [Function],
"__get": [Function],
"__getLastCreatedEntityKey": [Function],
"__mergeData": [Function],
"__replaceData": [Function],
"add": [Function],
"create": [Function],
"get": [Function],
"getLastCreatedEntityKey": [Function],
"mergeData": [Function],
"replaceData": [Function],
"1": "1",
},
"blockMap": Immutable.OrderedMap {
"a": Immutable.Record {

Wyświetl plik

@ -5,18 +5,7 @@ exports[`Link works 1`] = `
contentState={
Immutable.Record {
"entityMap": Object {
"__add": [Function],
"__create": [Function],
"__get": [Function],
"__getLastCreatedEntityKey": [Function],
"__mergeData": [Function],
"__replaceData": [Function],
"add": [Function],
"create": [Function],
"get": [Function],
"getLastCreatedEntityKey": [Function],
"mergeData": [Function],
"replaceData": [Function],
"1": "1",
},
"blockMap": Immutable.OrderedMap {
"a": Immutable.Record {

Wyświetl plik

@ -93,10 +93,8 @@ Blocks are nearly as simple as inline styles:
'type': type_,
'label': '❝',
'description': 'Blockquote',
# We need to tell Draftail what element to use when displaying those blocks in the editor.
# Optionally, we can tell Draftail what element to use when displaying those blocks in the editor.
'element': 'blockquote',
# This isn't required as the blockquote tag could be styled directly.
# 'className': 'editor__blockquote',
}
features.register_editor_plugin(
@ -110,12 +108,13 @@ Blocks are nearly as simple as inline styles:
Here are the main differences:
* We need to configure an ``element`` to tell Draftail how to render those blocks in the editor.
* We could use a ``className`` (say if ``element`` was ``div``) to style the blockquotes in the editor.
* We can configure an ``element`` to tell Draftail how to render those blocks in the editor.
* We register the plugin with ``BlockFeature``.
* We set up the conversion with ``BlockElementHandler`` and ``block_map``.
Thats it! The extra complexity is that you may need to write CSS in conjunction with the ``className`` to style the blocks in the editor.
Optionally, we can also define styles for the blocks with the ``Draftail-block--blockquote`` (``Draftail-block--<block type>``) CSS class.
Thats it! The extra complexity is that you may need to write CSS to style the blocks in the editor.
Creating new entities
~~~~~~~~~~~~~~~~~~~~~

20
package-lock.json wygenerowano
Wyświetl plik

@ -2609,9 +2609,9 @@
}
},
"draft-js": {
"version": "0.10.4",
"resolved": "https://registry.npmjs.org/draft-js/-/draft-js-0.10.4.tgz",
"integrity": "sha1-FHdBZCCXyBINjtwjLpUD6Lf7jTU=",
"version": "0.10.5",
"resolved": "https://registry.npmjs.org/draft-js/-/draft-js-0.10.5.tgz",
"integrity": "sha512-LE6jSCV9nkPhfVX2ggcRLA4FKs6zWq9ceuO/88BpXdNCS7mjRTgs0NsV6piUCJX9YxMsB9An33wnkMmU2sD2Zg==",
"requires": {
"fbjs": "0.8.16",
"immutable": "3.7.6",
@ -2619,17 +2619,17 @@
}
},
"draftail": {
"version": "0.15.0",
"resolved": "https://registry.npmjs.org/draftail/-/draftail-0.15.0.tgz",
"integrity": "sha512-PARHHGuoRs8CKiRH0w1k9Bs+a0cxnNl8jwVyuj4CahgNj5x5jN/Z2zutyjVvpdJCcdR1/A525u9jIpDszt9jOg==",
"version": "0.16.0",
"resolved": "https://registry.npmjs.org/draftail/-/draftail-0.16.0.tgz",
"integrity": "sha512-Jz4a1VZ4/8iScobGsst57QlP2T5pkkATU+tfYzF+2Iom/m3T+9TvbV/bIr7WGaKynMC7YRSetyPpNYlCvuMpsQ==",
"requires": {
"draftjs-filters": "0.6.1"
"draftjs-filters": "0.7.0"
}
},
"draftjs-filters": {
"version": "0.6.1",
"resolved": "https://registry.npmjs.org/draftjs-filters/-/draftjs-filters-0.6.1.tgz",
"integrity": "sha512-8CyUUBglLKMVLrkOn7RfRoKoslx79SPvyc5w0lCJTLii/PbHP1narEW4eSNayIvcOIVcEQgOTjv2zXrH/Yuf9A=="
"version": "0.7.0",
"resolved": "https://registry.npmjs.org/draftjs-filters/-/draftjs-filters-0.7.0.tgz",
"integrity": "sha512-gNJB4bCPM7UNOzSkbVBj0OjxvNLlBeBmMsmfN6+UF311Ne7Yq76rXc1ibRIRWUSdOMWs+H8UZqYWmJW7mWsQ5g=="
},
"duplexer": {
"version": "0.1.1",

Wyświetl plik

@ -86,8 +86,8 @@
},
"dependencies": {
"core-js": "^2.5.3",
"draft-js": "0.10.4",
"draftail": "^0.15.0",
"draft-js": "0.10.5",
"draftail": "^0.16.0",
"focus-trap-react": "^3.1.0",
"prop-types": "^15.6.0",
"react": "^16.2.0",