on-codemerge
Version:
A WYSIWYG editor for on-codemerge is a user-friendly interface that allows users to edit and view their code in real time, exactly as it will appear in the final product
3 lines (2 loc) • 2.56 kB
JavaScript
/*! on-codemerge v1.3.1 @author Pavel Kuzmin @license MIT @homepage https://s00d.github.io/on-codemerge/ @repository git+https://github.com/s00d/on-codemerge.git Copyright (c) 2026 Pavel Kuzmin - Built on 2026-07-02T13:39:17.947Z */
"use strict";var S=Object.defineProperty;var C=(s,t,e)=>t in s?S(s,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):s[t]=e;var h=(s,t,e)=>C(s,typeof t!="symbol"?t+"":t,e);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("../../../utils/helpers.cjs");class m{constructor(t){h(this,"editor");h(this,"element",null);h(this,"stats",{});this.editor=t}createElement(){this.element=a.createContainer("editor-footer");const t=a.createContainer("editor-footer-block"),e=a.createContainer("flex items-center gap-4"),i=this.createStatElement(this.editor.t("Words"),"stat-words"),n=this.createStatElement(this.editor.t("Characters"),"stat-characters"),o=this.createStatElement(this.editor.t("Characters (without spaces)"),"stat-characters-no-spaces");e.appendChild(i),e.appendChild(n),e.appendChild(o);const r=a.createContainer("flex items-center gap-4"),c=this.createStatElement(this.editor.t("Sentences"),"stat-sentences"),d=this.createStatElement(this.editor.t("Paragraphs"),"stat-paragraphs"),p=this.createStatElement(this.editor.t("Reading time"),"stat-reading-time",this.editor.t("min")),l=a.createContainer("collaboration-status");return r.appendChild(l),r.appendChild(c),r.appendChild(d),r.appendChild(p),t.appendChild(e),t.appendChild(r),this.element.appendChild(t),this.stats={words:i,characters:n,charactersNoSpaces:o,sentences:c,paragraphs:d,readingTime:p},this.element}createStatElement(t,e,i=""){const n=a.createContainer(),o=a.createSpan("",`${t}: `);o.textContent=`${t}: `;const r=a.createSpan("",`${e} font-medium`);if(r.textContent="0",n.appendChild(o),n.appendChild(r),i){const c=a.createSpan("",` ${i}`);n.appendChild(c)}return n}update(t){this.element&&(this.stats.words.textContent=this.editor.t("Words")+": "+t.words.toLocaleString(),this.stats.characters.textContent=this.editor.t("Characters")+": "+t.characters.toLocaleString(),this.stats.charactersNoSpaces.textContent=this.editor.t("Characters (without spaces)")+": "+t.charactersNoSpaces.toLocaleString(),this.stats.sentences.textContent=this.editor.t("Sentences")+": "+t.sentences.toLocaleString(),this.stats.paragraphs.textContent=this.editor.t("Paragraphs")+": "+t.paragraphs.toLocaleString(),this.stats.readingTime.textContent=this.editor.t("Reading time")+": "+t.readingTime.toString())}}exports.FooterRenderer=m;