@aeaton/react-prosemirror
Advanced tools
Comparing version 0.9.5 to 0.9.6
@@ -64,3 +64,3 @@ module.exports = | ||
/******/ // Load entry module and return exports | ||
/******/ return __webpack_require__(__webpack_require__.s = 5); | ||
/******/ return __webpack_require__(__webpack_require__.s = 4); | ||
/******/ }) | ||
@@ -213,3 +213,3 @@ /************************************************************************/ | ||
var fixUrls = __webpack_require__(10); | ||
var fixUrls = __webpack_require__(9); | ||
@@ -546,14 +546,10 @@ module.exports = function(list, options) { | ||
var _prosemirrorState = __webpack_require__(6); | ||
var _prosemirrorState = __webpack_require__(5); | ||
var _prosemirrorView = __webpack_require__(4); | ||
var _prosemirrorView = __webpack_require__(6); | ||
var _decorations = __webpack_require__(7); | ||
__webpack_require__(7); | ||
var _decorations2 = _interopRequireDefault(_decorations); | ||
__webpack_require__(10); | ||
__webpack_require__(8); | ||
__webpack_require__(11); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
@@ -580,3 +576,5 @@ | ||
dispatchTransaction: _this.dispatchTransaction, | ||
decorations: (0, _decorations2.default)(_this.props) | ||
attributes: { | ||
placeholder: _this.props.placeholder | ||
} | ||
}); | ||
@@ -623,8 +621,2 @@ | ||
/* 4 */ | ||
/***/ (function(module, exports) { | ||
module.exports = require("prosemirror-view"); | ||
/***/ }), | ||
/* 5 */ | ||
/***/ (function(module, exports, __webpack_require__) { | ||
@@ -648,3 +640,3 @@ | ||
var _HtmlEditor = __webpack_require__(13); | ||
var _HtmlEditor = __webpack_require__(12); | ||
@@ -658,3 +650,3 @@ Object.defineProperty(exports, 'HtmlEditor', { | ||
var _MenuBar = __webpack_require__(16); | ||
var _MenuBar = __webpack_require__(15); | ||
@@ -671,3 +663,3 @@ Object.defineProperty(exports, 'MenuBar', { | ||
/***/ }), | ||
/* 6 */ | ||
/* 5 */ | ||
/***/ (function(module, exports) { | ||
@@ -678,40 +670,9 @@ | ||
/***/ }), | ||
/* 7 */ | ||
/***/ (function(module, exports, __webpack_require__) { | ||
/* 6 */ | ||
/***/ (function(module, exports) { | ||
"use strict"; | ||
module.exports = require("prosemirror-view"); | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
var _prosemirrorView = __webpack_require__(4); | ||
var isEmpty = function isEmpty(doc) { | ||
return doc.childCount === 1 && doc.firstChild.isTextblock && doc.firstChild.content.size === 0; | ||
}; | ||
var placeholder = function placeholder(content) { | ||
var container = document.createElement('div'); | ||
container.textContent = content; | ||
container.classList.add('placeholder'); | ||
return _prosemirrorView.Decoration.widget(1, container); | ||
}; | ||
exports.default = function (props) { | ||
return function (state) { | ||
var decorations = []; | ||
if (props.placeholder && isEmpty(state.doc)) { | ||
decorations.push(placeholder(props.placeholder)); | ||
} | ||
return _prosemirrorView.DecorationSet.create(state.doc, decorations); | ||
}; | ||
}; | ||
/***/ }), | ||
/* 8 */ | ||
/* 7 */ | ||
/***/ (function(module, exports, __webpack_require__) { | ||
@@ -722,3 +683,3 @@ | ||
// load the styles | ||
var content = __webpack_require__(9); | ||
var content = __webpack_require__(8); | ||
if(typeof content === 'string') content = [[module.i, content, '']]; | ||
@@ -748,3 +709,3 @@ // Prepare cssTransformation | ||
/***/ }), | ||
/* 9 */ | ||
/* 8 */ | ||
/***/ (function(module, exports, __webpack_require__) { | ||
@@ -763,3 +724,3 @@ | ||
/***/ }), | ||
/* 10 */ | ||
/* 9 */ | ||
/***/ (function(module, exports) { | ||
@@ -859,3 +820,3 @@ | ||
/***/ }), | ||
/* 11 */ | ||
/* 10 */ | ||
/***/ (function(module, exports, __webpack_require__) { | ||
@@ -866,3 +827,3 @@ | ||
// load the styles | ||
var content = __webpack_require__(12); | ||
var content = __webpack_require__(11); | ||
if(typeof content === 'string') content = [[module.i, content, '']]; | ||
@@ -892,3 +853,3 @@ // Prepare cssTransformation | ||
/***/ }), | ||
/* 12 */ | ||
/* 11 */ | ||
/***/ (function(module, exports, __webpack_require__) { | ||
@@ -901,3 +862,3 @@ | ||
// module | ||
exports.push([module.i, ".ProseMirror {\n font-family: -apple-system, system-ui, BlinkMacSystemFont, \"Segoe UI\", Roboto, \"Helvetica Neue\", Arial, sans-serif;\n padding: 10px;\n background: #fff;\n}\n\n.ProseMirror:focus {\n outline: none;\n}\n\n.ProseMirror .placeholder {\n color: #aaa;\n pointer-events: none;\n height: 0;\n}\n\n.ProseMirror hr {\n padding: 2px 10px;\n border: none;\n margin: 1em 0;\n}\n\n.ProseMirror hr:after {\n content: \"\";\n display: block;\n height: 1px;\n background-color: silver;\n line-height: 2px;\n}\n\n.ProseMirror ul, .ProseMirror ol {\n padding-left: 30px;\n}\n\n.ProseMirror blockquote {\n padding-left: 1em;\n border-left: 3px solid #eee;\n margin-left: 0;\n margin-right: 0;\n}\n\n.ProseMirror img {\n cursor: default;\n}\n\n.ProseMirror th,\n.ProseMirror td {\n border: 1px solid #eee;\n padding: 2px 5px;\n}\n\n.ProseMirror sup,\n.ProseMirror sub {\n line-height: 0;\n}\n", ""]); | ||
exports.push([module.i, ".ProseMirror {\n font-family: -apple-system, system-ui, BlinkMacSystemFont, \"Segoe UI\", Roboto, \"Helvetica Neue\", Arial, sans-serif;\n padding: 10px;\n background: #fff;\n}\n\n.ProseMirror:focus {\n outline: none;\n}\n\n.ProseMirror hr {\n padding: 2px 10px;\n border: none;\n margin: 1em 0;\n}\n\n.ProseMirror hr:after {\n content: \"\";\n display: block;\n height: 1px;\n background-color: silver;\n line-height: 2px;\n}\n\n.ProseMirror ul, .ProseMirror ol {\n padding-left: 30px;\n}\n\n.ProseMirror blockquote {\n padding-left: 1em;\n border-left: 3px solid #eee;\n margin-left: 0;\n margin-right: 0;\n}\n\n.ProseMirror img {\n cursor: default;\n}\n\n.ProseMirror th,\n.ProseMirror td {\n border: 1px solid #eee;\n padding: 2px 5px;\n}\n\n.ProseMirror sup,\n.ProseMirror sub {\n line-height: 0;\n}\n", ""]); | ||
@@ -908,3 +869,3 @@ // exports | ||
/***/ }), | ||
/* 13 */ | ||
/* 12 */ | ||
/***/ (function(module, exports, __webpack_require__) { | ||
@@ -925,7 +886,7 @@ | ||
var _debounce = __webpack_require__(14); | ||
var _debounce = __webpack_require__(13); | ||
var _debounce2 = _interopRequireDefault(_debounce); | ||
var _prosemirrorModel = __webpack_require__(15); | ||
var _prosemirrorModel = __webpack_require__(14); | ||
@@ -1018,3 +979,3 @@ var _Editor = __webpack_require__(3); | ||
/***/ }), | ||
/* 14 */ | ||
/* 13 */ | ||
/***/ (function(module, exports) { | ||
@@ -1025,3 +986,3 @@ | ||
/***/ }), | ||
/* 15 */ | ||
/* 14 */ | ||
/***/ (function(module, exports) { | ||
@@ -1032,3 +993,3 @@ | ||
/***/ }), | ||
/* 16 */ | ||
/* 15 */ | ||
/***/ (function(module, exports, __webpack_require__) { | ||
@@ -1047,11 +1008,11 @@ | ||
var _map = __webpack_require__(17); | ||
var _map = __webpack_require__(16); | ||
var _map2 = _interopRequireDefault(_map); | ||
var _classnames2 = __webpack_require__(18); | ||
var _classnames2 = __webpack_require__(17); | ||
var _classnames3 = _interopRequireDefault(_classnames2); | ||
var _MenuBarModule = __webpack_require__(19); | ||
var _MenuBarModule = __webpack_require__(18); | ||
@@ -1111,3 +1072,3 @@ var _MenuBarModule2 = _interopRequireDefault(_MenuBarModule); | ||
/***/ }), | ||
/* 17 */ | ||
/* 16 */ | ||
/***/ (function(module, exports) { | ||
@@ -1118,3 +1079,3 @@ | ||
/***/ }), | ||
/* 18 */ | ||
/* 17 */ | ||
/***/ (function(module, exports) { | ||
@@ -1125,3 +1086,3 @@ | ||
/***/ }), | ||
/* 19 */ | ||
/* 18 */ | ||
/***/ (function(module, exports, __webpack_require__) { | ||
@@ -1132,3 +1093,3 @@ | ||
// load the styles | ||
var content = __webpack_require__(20); | ||
var content = __webpack_require__(19); | ||
if(typeof content === 'string') content = [[module.i, content, '']]; | ||
@@ -1158,3 +1119,3 @@ // Prepare cssTransformation | ||
/***/ }), | ||
/* 20 */ | ||
/* 19 */ | ||
/***/ (function(module, exports, __webpack_require__) { | ||
@@ -1161,0 +1122,0 @@ |
{ | ||
"name": "@aeaton/react-prosemirror", | ||
"version": "0.9.5", | ||
"version": "0.9.6", | ||
"description": "A React component for ProseMirror", | ||
@@ -5,0 +5,0 @@ "main": "dist", |
import React from 'react' | ||
import { EditorState } from 'prosemirror-state' | ||
import { EditorView } from 'prosemirror-view' | ||
import decorations from './decorations' | ||
import 'prosemirror-view/style/prosemirror.css' | ||
@@ -22,3 +21,5 @@ import './Editor.css' | ||
dispatchTransaction: this.dispatchTransaction, | ||
decorations: decorations(this.props) | ||
attributes: { | ||
placeholder: this.props.placeholder | ||
} | ||
}) | ||
@@ -25,0 +26,0 @@ |
@@ -22,3 +22,3 @@ An editor for content stored as ProseMirror JSON. | ||
placeholder="Enter some text…" | ||
autofocus | ||
autoFocus | ||
onChange={doc => setState({ doc })} | ||
@@ -25,0 +25,0 @@ render={({ editor, state, dispatch }) => ( |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
43879
12
1076