@aeaton/prosemirror-placeholder
Advanced tools
Comparing version 0.0.4 to 0.0.5
@@ -142,26 +142,45 @@ module.exports = | ||
// style-loader: Adds some css to the DOM by adding a <style> tag | ||
// load the styles | ||
var content = __webpack_require__(5); | ||
if(typeof content === 'string') content = [[module.i, content, '']]; | ||
// Prepare cssTransformation | ||
var transform; | ||
var insertInto; | ||
var options = {"hmr":true} | ||
options.transform = transform | ||
// add the styles to the DOM | ||
options.insertInto = undefined; | ||
var update = __webpack_require__(7)(content, options); | ||
if(content.locals) module.exports = content.locals; | ||
// Hot Module Replacement | ||
if(false) { | ||
// When the styles change, update the <style> tags | ||
if(!content.locals) { | ||
module.hot.accept("!!../../node_modules/css-loader/index.js!./placeholder.css", function() { | ||
var newContent = require("!!../../node_modules/css-loader/index.js!./placeholder.css"); | ||
if(typeof newContent === 'string') newContent = [[module.id, newContent, '']]; | ||
update(newContent); | ||
}); | ||
} | ||
// When the module is disposed, remove the <style> tags | ||
module.hot.accept("!!../../node_modules/css-loader/index.js!./placeholder.css", function() { | ||
var newContent = require("!!../../node_modules/css-loader/index.js!./placeholder.css"); | ||
if(typeof newContent === 'string') newContent = [[module.id, newContent, '']]; | ||
var locals = (function(a, b) { | ||
var key, idx = 0; | ||
for(key in a) { | ||
if(!b || a[key] !== b[key]) return false; | ||
idx++; | ||
} | ||
for(key in b) idx--; | ||
return idx === 0; | ||
}(content.locals, newContent.locals)); | ||
if(!locals) throw new Error('Aborting CSS HMR due to changed css-modules locals.'); | ||
update(newContent); | ||
}); | ||
module.hot.dispose(function() { update(); }); | ||
@@ -295,10 +314,22 @@ } | ||
var getTarget = function (target) { | ||
return document.querySelector(target); | ||
}; | ||
var getElement = (function (fn) { | ||
var memo = {}; | ||
return function(selector) { | ||
if (typeof memo[selector] === "undefined") { | ||
var styleTarget = fn.call(this, selector); | ||
return function(target) { | ||
// If passing function in options, then use it for resolve "head" element. | ||
// Useful for Shadow Root style i.e | ||
// { | ||
// insertInto: function () { return document.querySelector("#foo").shadowRoot } | ||
// } | ||
if (typeof target === 'function') { | ||
return target(); | ||
} | ||
if (typeof memo[target] === "undefined") { | ||
var styleTarget = getTarget.call(this, target); | ||
// Special case to return head of iframe instead of iframe itself | ||
if (styleTarget instanceof window.HTMLIFrameElement) { | ||
if (window.HTMLIFrameElement && styleTarget instanceof window.HTMLIFrameElement) { | ||
try { | ||
@@ -312,9 +343,7 @@ // This will throw an exception if access to iframe is blocked | ||
} | ||
memo[selector] = styleTarget; | ||
memo[target] = styleTarget; | ||
} | ||
return memo[selector] | ||
return memo[target] | ||
}; | ||
})(function (target) { | ||
return document.querySelector(target) | ||
}); | ||
})(); | ||
@@ -341,3 +370,3 @@ var singleton = null; | ||
// By default, add <style> tags to the <head> element | ||
if (!options.insertInto) options.insertInto = "head"; | ||
if (!options.insertInto) options.insertInto = "head"; | ||
@@ -344,0 +373,0 @@ // By default, add <style> tags to the bottom of the target |
{ | ||
"name": "@aeaton/prosemirror-placeholder", | ||
"version": "0.0.4", | ||
"version": "0.0.5", | ||
"description": "A placeholder plugin for ProseMirror", | ||
@@ -16,3 +16,3 @@ "repository": "hubgit/react-prosemirror", | ||
"dependencies": { | ||
"prosemirror-state": "^1.0.1", | ||
"prosemirror-state": "^1.1.0", | ||
"prosemirror-view": "^1.0.0" | ||
@@ -28,3 +28,3 @@ }, | ||
"css-loader": "^0.28.7", | ||
"style-loader": "^0.19.0", | ||
"style-loader": "^0.20.1", | ||
"webpack": "^3.8.1", | ||
@@ -31,0 +31,0 @@ "webpack-node-externals": "^1.6.0" |
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
23573
633
Updatedprosemirror-state@^1.1.0