efd
This commit is contained in:
parent
8ffd16e44f
commit
b07ca4804c
1 changed files with 195 additions and 20 deletions
|
@ -65,6 +65,9 @@
|
|||
function set_input_value(input, value) {
|
||||
input.value = value == null ? '' : value;
|
||||
}
|
||||
function set_style(node, key, value, important) {
|
||||
node.style.setProperty(key, value, important ? 'important' : '');
|
||||
}
|
||||
function custom_event(type, detail, bubbles = false) {
|
||||
const e = document.createEvent('CustomEvent');
|
||||
e.initCustomEvent(type, bubbles, false, detail);
|
||||
|
@ -366,21 +369,129 @@
|
|||
/* src\App.svelte generated by Svelte v3.42.6 */
|
||||
const file = "src\\App.svelte";
|
||||
|
||||
// (21:1) {:else}
|
||||
function create_else_block(ctx) {
|
||||
let t;
|
||||
|
||||
const block = {
|
||||
c: function create() {
|
||||
t = text("Show preview");
|
||||
},
|
||||
m: function mount(target, anchor) {
|
||||
insert_dev(target, t, anchor);
|
||||
},
|
||||
d: function destroy(detaching) {
|
||||
if (detaching) detach_dev(t);
|
||||
}
|
||||
};
|
||||
|
||||
dispatch_dev("SvelteRegisterBlock", {
|
||||
block,
|
||||
id: create_else_block.name,
|
||||
type: "else",
|
||||
source: "(21:1) {:else}",
|
||||
ctx
|
||||
});
|
||||
|
||||
return block;
|
||||
}
|
||||
|
||||
// (19:1) {#if show_preview}
|
||||
function create_if_block_1(ctx) {
|
||||
let t;
|
||||
|
||||
const block = {
|
||||
c: function create() {
|
||||
t = text("Hide preview");
|
||||
},
|
||||
m: function mount(target, anchor) {
|
||||
insert_dev(target, t, anchor);
|
||||
},
|
||||
d: function destroy(detaching) {
|
||||
if (detaching) detach_dev(t);
|
||||
}
|
||||
};
|
||||
|
||||
dispatch_dev("SvelteRegisterBlock", {
|
||||
block,
|
||||
id: create_if_block_1.name,
|
||||
type: "if",
|
||||
source: "(19:1) {#if show_preview}",
|
||||
ctx
|
||||
});
|
||||
|
||||
return block;
|
||||
}
|
||||
|
||||
// (28:0) {#if show_preview}
|
||||
function create_if_block(ctx) {
|
||||
let html_tag;
|
||||
let raw_value = marked__default['default'](marking(/*text*/ ctx[0])) + "";
|
||||
let html_anchor;
|
||||
|
||||
const block = {
|
||||
c: function create() {
|
||||
html_tag = new HtmlTag();
|
||||
html_anchor = empty();
|
||||
html_tag.a = html_anchor;
|
||||
},
|
||||
m: function mount(target, anchor) {
|
||||
html_tag.m(raw_value, target, anchor);
|
||||
insert_dev(target, html_anchor, anchor);
|
||||
},
|
||||
p: function update(ctx, dirty) {
|
||||
if (dirty & /*text*/ 1 && raw_value !== (raw_value = marked__default['default'](marking(/*text*/ ctx[0])) + "")) html_tag.p(raw_value);
|
||||
},
|
||||
d: function destroy(detaching) {
|
||||
if (detaching) detach_dev(html_anchor);
|
||||
if (detaching) html_tag.d();
|
||||
}
|
||||
};
|
||||
|
||||
dispatch_dev("SvelteRegisterBlock", {
|
||||
block,
|
||||
id: create_if_block.name,
|
||||
type: "if",
|
||||
source: "(28:0) {#if show_preview}",
|
||||
ctx
|
||||
});
|
||||
|
||||
return block;
|
||||
}
|
||||
|
||||
function create_fragment(ctx) {
|
||||
let textarea;
|
||||
let t;
|
||||
let html_tag;
|
||||
let raw_value = marked__default['default'](/*text*/ ctx[0]) + "";
|
||||
let html_anchor;
|
||||
let t0;
|
||||
let div;
|
||||
let t1;
|
||||
let pre;
|
||||
let t2;
|
||||
let t3;
|
||||
let span;
|
||||
let mounted;
|
||||
let dispose;
|
||||
|
||||
function select_block_type(ctx, dirty) {
|
||||
if (/*show_preview*/ ctx[1]) return create_if_block_1;
|
||||
return create_else_block;
|
||||
}
|
||||
|
||||
let current_block_type = select_block_type(ctx);
|
||||
let if_block0 = current_block_type(ctx);
|
||||
let if_block1 = /*show_preview*/ ctx[1] && create_if_block(ctx);
|
||||
|
||||
const block = {
|
||||
c: function create() {
|
||||
textarea = element("textarea");
|
||||
t = space();
|
||||
html_tag = new HtmlTag();
|
||||
html_anchor = empty();
|
||||
t0 = space();
|
||||
div = element("div");
|
||||
if_block0.c();
|
||||
t1 = space();
|
||||
pre = element("pre");
|
||||
t2 = space();
|
||||
if (if_block1) if_block1.c();
|
||||
t3 = space();
|
||||
span = element("span");
|
||||
attr_dev(textarea, "form", "submitform");
|
||||
attr_dev(textarea, "id", "post-text");
|
||||
attr_dev(textarea, "class", "form-control rounded");
|
||||
|
@ -391,8 +502,17 @@
|
|||
attr_dev(textarea, "oninput", "charLimit('post-text','character-count-submit-text-form');checkForRequired()");
|
||||
attr_dev(textarea, "maxlength", "10000");
|
||||
textarea.required = true;
|
||||
add_location(textarea, file, 5, 0, 66);
|
||||
html_tag.a = html_anchor;
|
||||
add_location(textarea, file, 15, 0, 247);
|
||||
attr_dev(div, "class", "btn btn-secondary");
|
||||
set_style(div, "float", "right");
|
||||
add_location(div, file, 17, 0, 567);
|
||||
add_location(pre, file, 25, 0, 722);
|
||||
attr_dev(span, "class", "position-absolute text-small font-weight-bold");
|
||||
attr_dev(span, "id", "character-count-submit-text-form");
|
||||
set_style(span, "right", "1rem");
|
||||
set_style(span, "bottom", "0.5rem");
|
||||
set_style(span, "z-index", "3");
|
||||
add_location(span, file, 31, 0, 792);
|
||||
},
|
||||
l: function claim(nodes) {
|
||||
throw new Error("options.hydrate only works if the component was compiled with the `hydratable: true` option");
|
||||
|
@ -400,12 +520,22 @@
|
|||
m: function mount(target, anchor) {
|
||||
insert_dev(target, textarea, anchor);
|
||||
set_input_value(textarea, /*text*/ ctx[0]);
|
||||
insert_dev(target, t, anchor);
|
||||
html_tag.m(raw_value, target, anchor);
|
||||
insert_dev(target, html_anchor, anchor);
|
||||
insert_dev(target, t0, anchor);
|
||||
insert_dev(target, div, anchor);
|
||||
if_block0.m(div, null);
|
||||
insert_dev(target, t1, anchor);
|
||||
insert_dev(target, pre, anchor);
|
||||
insert_dev(target, t2, anchor);
|
||||
if (if_block1) if_block1.m(target, anchor);
|
||||
insert_dev(target, t3, anchor);
|
||||
insert_dev(target, span, anchor);
|
||||
|
||||
if (!mounted) {
|
||||
dispose = listen_dev(textarea, "input", /*textarea_input_handler*/ ctx[1]);
|
||||
dispose = [
|
||||
listen_dev(textarea, "input", /*textarea_input_handler*/ ctx[3]),
|
||||
listen_dev(div, "click", /*togglePreview*/ ctx[2], false, false, false)
|
||||
];
|
||||
|
||||
mounted = true;
|
||||
}
|
||||
},
|
||||
|
@ -414,17 +544,44 @@
|
|||
set_input_value(textarea, /*text*/ ctx[0]);
|
||||
}
|
||||
|
||||
if (dirty & /*text*/ 1 && raw_value !== (raw_value = marked__default['default'](/*text*/ ctx[0]) + "")) html_tag.p(raw_value);
|
||||
if (current_block_type !== (current_block_type = select_block_type(ctx))) {
|
||||
if_block0.d(1);
|
||||
if_block0 = current_block_type(ctx);
|
||||
|
||||
if (if_block0) {
|
||||
if_block0.c();
|
||||
if_block0.m(div, null);
|
||||
}
|
||||
}
|
||||
|
||||
if (/*show_preview*/ ctx[1]) {
|
||||
if (if_block1) {
|
||||
if_block1.p(ctx, dirty);
|
||||
} else {
|
||||
if_block1 = create_if_block(ctx);
|
||||
if_block1.c();
|
||||
if_block1.m(t3.parentNode, t3);
|
||||
}
|
||||
} else if (if_block1) {
|
||||
if_block1.d(1);
|
||||
if_block1 = null;
|
||||
}
|
||||
},
|
||||
i: noop,
|
||||
o: noop,
|
||||
d: function destroy(detaching) {
|
||||
if (detaching) detach_dev(textarea);
|
||||
if (detaching) detach_dev(t);
|
||||
if (detaching) detach_dev(html_anchor);
|
||||
if (detaching) html_tag.d();
|
||||
if (detaching) detach_dev(t0);
|
||||
if (detaching) detach_dev(div);
|
||||
if_block0.d();
|
||||
if (detaching) detach_dev(t1);
|
||||
if (detaching) detach_dev(pre);
|
||||
if (detaching) detach_dev(t2);
|
||||
if (if_block1) if_block1.d(detaching);
|
||||
if (detaching) detach_dev(t3);
|
||||
if (detaching) detach_dev(span);
|
||||
mounted = false;
|
||||
dispose();
|
||||
run_all(dispose);
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -439,10 +596,21 @@
|
|||
return block;
|
||||
}
|
||||
|
||||
function marking(input) {
|
||||
markdown = input.replace("sex", "fuck");
|
||||
return markdown;
|
||||
}
|
||||
|
||||
function instance($$self, $$props, $$invalidate) {
|
||||
let { $$slots: slots = {}, $$scope } = $$props;
|
||||
validate_slots('App', slots, []);
|
||||
let text = ``;
|
||||
let show_preview = false;
|
||||
|
||||
function togglePreview() {
|
||||
$$invalidate(1, show_preview = !show_preview);
|
||||
}
|
||||
|
||||
const writable_props = [];
|
||||
|
||||
Object.keys($$props).forEach(key => {
|
||||
|
@ -454,17 +622,24 @@
|
|||
$$invalidate(0, text);
|
||||
}
|
||||
|
||||
$$self.$capture_state = () => ({ marked: marked__default['default'], text });
|
||||
$$self.$capture_state = () => ({
|
||||
marked: marked__default['default'],
|
||||
text,
|
||||
show_preview,
|
||||
marking,
|
||||
togglePreview
|
||||
});
|
||||
|
||||
$$self.$inject_state = $$props => {
|
||||
if ('text' in $$props) $$invalidate(0, text = $$props.text);
|
||||
if ('show_preview' in $$props) $$invalidate(1, show_preview = $$props.show_preview);
|
||||
};
|
||||
|
||||
if ($$props && "$$inject" in $$props) {
|
||||
$$self.$inject_state($$props.$$inject);
|
||||
}
|
||||
|
||||
return [text, textarea_input_handler];
|
||||
return [text, show_preview, togglePreview, textarea_input_handler];
|
||||
}
|
||||
|
||||
class App extends SvelteComponentDev {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue