planning
All checks were successful
Publish To Prod / deploy_and_publish (push) Successful in 35s

This commit is contained in:
2024-10-14 09:15:30 +02:00
parent bcba00a730
commit 6e64e138e2
21059 changed files with 2317811 additions and 1 deletions

View File

@@ -0,0 +1,105 @@
(function (global, factory) {
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('slate')) :
typeof define === 'function' && define.amd ? define(['exports', 'slate'], factory) :
(factory((global.SlateBase64Serializer = {}),global.Slate));
}(this, (function (exports,slate) { 'use strict';
var atob = self.atob.bind(self);
var btoa = self.btoa.bind(self);
/**
* Encode a JSON `object` as base-64 `string`.
*
* @param {Object} object
* @return {String}
*/
function encode(object) {
var string = JSON.stringify(object);
var encoded = btoa(encodeURIComponent(string));
return encoded;
}
/**
* Decode a base-64 `string` to a JSON `object`.
*
* @param {String} string
* @return {Object}
*/
function decode(string) {
var decoded = decodeURIComponent(atob(string));
var object = JSON.parse(decoded);
return object;
}
/**
* Deserialize a Value `string`.
*
* @param {String} string
* @return {Value}
*/
function deserialize(string, options) {
var raw = decode(string);
var value = slate.Value.fromJSON(raw, options);
return value;
}
/**
* Deserialize a Node `string`.
*
* @param {String} string
* @return {Node}
*/
function deserializeNode(string, options) {
var raw = decode(string);
var node = slate.Node.fromJSON(raw, options);
return node;
}
/**
* Serialize a `value`.
*
* @param {Value} value
* @return {String}
*/
function serialize(value, options) {
var raw = value.toJSON(options);
var encoded = encode(raw);
return encoded;
}
/**
* Serialize a `node`.
*
* @param {Node} node
* @return {String}
*/
function serializeNode(node, options) {
var raw = node.toJSON(options);
var encoded = encode(raw);
return encoded;
}
/**
* Export.
*
* @type {Object}
*/
var index = {
deserialize: deserialize,
deserializeNode: deserializeNode,
serialize: serialize,
serializeNode: serializeNode
};
exports.default = index;
Object.defineProperty(exports, '__esModule', { value: true });
})));

View File

@@ -0,0 +1 @@
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("slate")):"function"==typeof define&&define.amd?define(["exports","slate"],t):t(e.SlateBase64Serializer={},e.Slate)}(this,function(e,t){"use strict";var n=self.atob.bind(self),r=self.btoa.bind(self);function o(e){var t=JSON.stringify(e);return r(encodeURIComponent(t))}function i(e){var t=decodeURIComponent(n(e));return JSON.parse(t)}var f={deserialize:function(e,n){var r=i(e);return t.Value.fromJSON(r,n)},deserializeNode:function(e,n){var r=i(e);return t.Node.fromJSON(r,n)},serialize:function(e,t){return o(e.toJSON(t))},serializeNode:function(e,t){return o(e.toJSON(t))}};e.default=f,Object.defineProperty(e,"__esModule",{value:!0})});