{"_id":"@prezly/slate-edit-list","_rev":"26-a38207e72c6852b623b0529c11cc14ec","name":"@prezly/slate-edit-list","dist-tags":{"latest":"0.13.0"},"versions":{"0.13.0":{"name":"@prezly/slate-edit-list","version":"0.13.0","keywords":["slate"],"license":"Apache-2.0","_id":"@prezly/slate-edit-list@0.13.0","maintainers":[{"name":"e1npm","email":"ivan.voskoboinyk@gmail.com"},{"name":"kamilmielnik","email":"kamil.adam.mielnik@gmail.com"},{"name":"kudlik","email":"kudlajzzz@gmail.com"},{"name":"markogresak","email":"gresak.marko@gmail.com"}],"homepage":"https://github.com/prezly/slate-edit-list#readme","bugs":{"url":"https://github.com/prezly/slate-edit-list/issues"},"dist":{"shasum":"fda1b0fbf4bb30bdc3c74e1208ee413bfde0b50f","tarball":"https://registry.npmjs.org/@prezly/slate-edit-list/-/slate-edit-list-0.13.0.tgz","fileCount":54,"integrity":"sha512-bpWF5nUNOeZBDLUpAQTiyb6JIWen0Ah4Irz1V7m9FyqjszyhXp5ZEkDy2WudOzYP85tOwJWLv2jD9xysbN8a9g==","signatures":[{"sig":"MEQCICd+SIVw8p1P6zifMb02i/BnoF+tDtiiAyuv04vkVV17AiBp2ZQ2zldaennU73ra0x5Hpqo0oOiGSL2JpGVpPaK49g==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":79985,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJc5pzBCRA9TVsSAnZWagAAXj8P/jQRURhMzr5vd5Zv1HAu\nh0LrmPZ3KGlnrNxKJu7rltOskeyZau05KJ39GgZTGXejqqvGHYQRNypAmWro\nhdBp3kFBWb0Z8JJ68bBPUfpdWaz7arkFofzJ1U24g+BrnYZqCuhaQOWTCqB/\nG4dKV7E655DT07dQRddQ8icmXaCcWThP9pCha5hUYSq/mb3qeJR6BaLYY4st\nS33lJXjhrgh165PQXBqJYCA9rJgw8uiat1UVP41wmjow5xjJhNyZkqmRzOYS\nhw/OmPnbxQQzfTVUroUgwLVBMT9SLgDsH+ky9NhTL5BlK0CONDvifpfXzFj2\nemh+IehoRxR7y7r1JbgROo9KhybxDwqA5p8Czs7IE5pfEY1AlkmE9G/+YvFW\ngm4pir2jvrsS93RbxeZNRsxPL8d0OQROdutnhznFCkSIbScec4r1UxF49TWs\nJY1yhzd+Qv39u6lKiL6RZ3UqbLB5Xp846MDHvy/0WtbHiE2CIesn1QXZXKaI\n/0ttIgC/bTJhBIryNRtiD1PNQLUOOsOxiCCTaRdUfx1S10A07YZSWVdRhhaY\nZUqeaZtaM7m3ZXKg7EDv/sxOUlrUm2DySY+FSBcxQqnwS8aZroQGfpu5rLuJ\nrwbBhjOH7iHFy4juahIY1eW26yH6u76+xPfBRqJjeGZQDTdXeCASM61RWef6\n95oA\r\n=tCqE\r\n-----END PGP SIGNATURE-----\r\n"},"main":"./dist/index.js","gitHead":"ec5a976f00367b17bfbc8cfe842816c11b248f91","scripts":{"lint":"eslint ./","test":"mocha ./tests/all.js --compilers js:babel-register --reporter=list","start":"npm run build-example && npm run serve-example","build:dist":"rm -r ./dist; babel ./lib --out-dir ./dist","build:flow":"flow-copy-source -v ./lib/ ./dist/","prepublish":"npm run build:dist && npm run build:flow","build-example":"browserify ./example/main.js -o ./example/bundle.js -t [ babelify --presets [ env react stage-0 ] ] -t [ stringify --extensions [.yaml] ]","serve-example":"http-server ./example/ -p 8081","deploy-example":"npm run build-example && gh-pages -d ./example"},"_npmUser":{"name":"kudlik","email":"kudlajzzz@gmail.com"},"deprecated":"Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.","repository":{"url":"git://github.com/prezly/slate-edit-list.git","type":"git"},"_npmVersion":"5.10.0","description":"A Slate plugin to handle keyboard events in lists.","directories":{},"_nodeVersion":"8.12.0","_hasShrinkwrap":false,"devDependencies":{"mocha":"^5.2.0","react":"^16.0.0","slate":"^0.44.2","eslint":"^5.6.0","expect":"^23.6.0","babelify":"^10.0.0","flow-bin":"^0.81.0","gh-pages":"^2.0.0","prettier":"^1.13.3","babel-cli":"^6.26.0","immutable":"^3.8.2","react-dom":"^16.0.0","stringify":"^5.1.0","babel-core":"^6.26.0","browserify":"^16.2.0","http-server":"^0.11.0","slate-react":"^0.21.12","babel-eslint":"^10.0.0","babel-preset-env":"^1.6.1","flow-copy-source":"^2.0.2","slate-hyperprint":"^2.2.5","babel-preset-flow":"^6.23.0","slate-hyperscript":"^0.11.21","babel-preset-react":"^6.24.1","eslint-plugin-react":"^7.8.2","babel-preset-stage-0":"^6.24.1","eslint-plugin-import":"^2.12.0","eslint-config-gitbook":"4.0.1","eslint-plugin-flowtype":"^2.48.0","eslint-plugin-jsx-a11y":"^6.0.3","eslint-plugin-prettier":"^2.6.0","babel-plugin-module-resolver":"^3.1.1","babel-plugin-transform-runtime":"^6.23.0","eslint-import-resolver-babel-module":"^4.0.0","babel-plugin-transform-flow-strip-types":"^6.22.0"},"peerDependencies":{"slate":"^0.44.0","immutable":"^3.8.2"},"_npmOperationalInternal":{"tmp":"tmp/slate-edit-list_0.13.0_1558617281199_0.7049312002449044","host":"s3://npm-registry-packages"}}},"time":{"created":"2019-05-23T13:14:41.006Z","modified":"2026-09-24T10:34:14.090Z","0.13.0":"2019-05-23T13:14:41.347Z"},"bugs":{"url":"https://github.com/prezly/slate-edit-list/issues"},"license":"Apache-2.0","homepage":"https://github.com/prezly/slate-edit-list#readme","keywords":["slate"],"repository":{"url":"git://github.com/prezly/slate-edit-list.git","type":"git"},"description":"A Slate plugin to handle keyboard events in lists.","maintainers":[{"email":"gijs@prezly.com","name":"digitalbase"},{"email":"francis@prezly.com","name":"francis-prezly"},{"email":"camil@prezly.com","name":"prezlynpm"},{"email":"jesse@prezly.com","name":"jessewynants"},{"email":"patrycja@prezly.com","name":"patrycja_prezly"},{"email":"edvinas@prezly.com","name":"edvinas_prezly"}],"readme":"# slate-edit-list\n\n[![NPM version](https://badge.fury.io/js/slate-edit-list.svg)](http://badge.fury.io/js/slate-edit-list)\n[![Linux Build Status](https://travis-ci.org/GitbookIO/slate-edit-list.png?branch=master)](https://travis-ci.org/GitbookIO/slate-edit-list)\n\nA Slate plugin to handle keyboard events in lists. List items can contain blocks.\n\nDemo: [gitbookio.github.io/slate-edit-list/](https://gitbookio.github.io/slate-edit-list/)\n\n### Install\n\n```\nnpm install slate-edit-list\n```\n\n### Features\n\nNatural keybindings:\n\n- Pressing <kbd>Enter</kbd> insert a new list item\n- Pressing <kbd>Shift+Enter</kbd> split the block in the list item\n- Pressing <kbd>Tab</kbd> increase the depth of the item (creates a sub-list)\n- Pressing <kbd>Shift+Tab</kbd> decrease the depth of the item\n- Pressing <kbd>Delete</kbd> (OSX) or <kbd>Backspace</kbd> at the start, remove the list item (or the list)\n\nSimple validation/normalization (see [assumptions about the schema](#assumption-about-the-schema)):\n\n- Lists can contain only list items, and at least one.\n- List items can only be the direct children of a list.\n- List items must always contain blocks.\n\nUseful transforms: see [Utilities and Transform](#utilities-and-transform).\n\n### Simple Usage\n\n```js\nimport EditList from 'slate-edit-list'\n\nconst plugins = [\n  EditList()\n]\n```\n\n#### Arguments\n\nThis plugin accepts options to redefine the following block types:\n\n- `types: string = [\"ol_list\", \"ul_list\"]` — the array of possible types for list containers. First value will be used as default.\n- `typeItem: string = \"list_item\"` — type for list items.\n- `typeDefault: string = \"paragraph\"` — type for default block in list items.\n- `canMerge: (Node, Node) => boolean` — controls which list can be merged automatically (for example when they are adjacent). Defaults to merging list with identical types\n\n\n#### Assumption about the schema\n\nYou can use this plugins with custom list block types (using plugin [arguments](#arguments)). But your lists structure should still conform to a few rules. These rules are implemented as schema.\n\nHere is what a minimal list would look like:\n\n\n```yaml\nnodes:\n    - kind: block\n      type: ul_list # Default type for bulleted lists container\n      nodes:\n          - kind: block\n            type: list_item # List containers can only contain list items\n            nodes:\n              # List items contain blocks. They cannot be the direct container of text.\n              - kind: block\n                type: paragraph # Default type of blocks in a list item\n                nodes:\n                  - kind: text\n                    text: Hello World\n```\n\nAnd here is an example of a multi-level list:\n\n```yaml\nnodes:\n  - kind: block\n    type: ol_list\n    nodes:\n      - kind: block\n        type: list_item\n        nodes:\n          - kind: block\n            type: paragraph\n            nodes:\n              - kind: text\n                text: Item 1\n          - kind: block\n            type: ol_list\n            nodes:\n              - kind: block\n                type: list_item\n                nodes:\n                  - kind: block\n                    type: paragraph\n                    nodes:\n                      - kind: text\n                        text: Item 1.1\n              - kind: block\n                type: list_item\n                nodes:\n                  - kind: block\n                    type: paragraph\n                    nodes:\n                      - kind: text\n                        text: Item 1.2\n```\n\n### Utilities and Transform\n\n`slate-edit-list` exports utilities and transforms:\n\n#### `plugin.utils.isSelectionInList(value: Value, type?: string) => Boolean`\n\nReturn true if selection is inside a list (and it can be unwrap). Optional param `type` can be supplied to deduce whether list is of specified type.\n\n#### `plugin.utils.isList(node: Node) => Boolean`\n\nReturn true if the node is one of the list type.\n\n#### `plugin.utils.getItemDepth(value: Value, block: Block?) => Number`\n\nReturns the depth of the current item (or the depth of the given block) in a list. 0 means not in a list.\n\n#### `plugin.utils.getCurrentItem(value: Value, block: Block?) => Block || Void`\n\nReturns the current item at selection (or at the given block).\n\n#### `plugin.utils.getCurrentList(value: Value, block: Block?) => Block || Void`\n\nReturns the current list at selection (or at the given block).\n\n#### `plugin.utils.getItemsAtRange(value: Value, range: Selection?) => List<Node>`\n\nReturn the list of items at the given range. The returned items are the highest list of of successive items that cover the given range.\n\nThe returned list is empty if no such list can be found.\n\n#### `plugin.changes.increaseItemDepth(change: Change) => Transform`\n\nIncrease the depth of the current item.\n\n#### `plugin.changes.decreaseItemDepth(change: Change) => Transform`\n\nDecrease the depth of the current item.\n\n#### `plugin.changes.wrapInList(change: Change, type: String?, data: Object|Data?) => Transform`\n\nWrap the current blocks in list items of a list container of the given type. You can pass optional data for the created list container.\n\n#### `plugin.changes.unwrapList(change: Change) => Transform`\n\nUnwrap all items at range from their list.\n\n#### `plugin.changes.splitListItem(change: Change) => Transform`\n\nSplit current block into a new list item.\n","readmeFilename":"README.md"}