1export default class Subscription { 2 static get toolbox() { 3 return { 4 'title': 'ÐодпиÑка', 5 } 6 } 7 8 constructor({ block, data }) { 9 this.block = block; 10 this.data = data; 11 } 12 13 render() { 14 const plugins = document.getElementById('editor_plugins'); 15 const pluginTemplate = plugins.querySelector('#subscription'); 16 const plugin = pluginTemplate.content.querySelector('.plugin-container'); 17 const insertPlugin = plugin.cloneNode(true); 18 insertPlugin.id = `subscription_${this.block.id}`; 19 20 insertPlugin.querySelectorAll('.block-field').forEach((field) => { 21 const savedFieldValue = this.data[field.name] ?? null; 22 field.value = savedFieldValue; 23 }); 24 25 return insertPlugin 26 } 27 28 save(blockContent) { 29 const data = {}; 30 31 blockContent.querySelectorAll('.block-field').forEach((field) => { 32 data[field.name] = field.value; 33 }); 34 35 return data; 36 } 37};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.