1import{G as d,P as o,V as p,h as l,a as c}from"./polyfazer-app-DumDTOPg.js";import{D as h}from"./diamond-section-behavior-oUm0C5jt.js";import{u,bG as m,H as i,I as v}from"./main-BEpca-0G.js";import{C as f,c as n}from"./markdown-frame-CiR2DQK4.js";import{l as y}from"./language-service-Y7DWP4JL.js";import{P as s}from"./page-toolbar-C-8EZufE.js";import"./polymer-utils-B8xivS0d.js";import"./BetterHTML-BN6nzApa.js";import"./BetterTemplateHandling-CTXk4mRb.js";import"./lang-helper-behavior-D3p_DZHb.js";import"./ExtendedDate-BLMVein7.js";import"./IdleManager-D5ySY0Fg.js";import"./paper-shrink-menu-C7LnALvz.js";import"./question-tag-C9ym_uv9.js";import"./diamond-icon-button-AIbsxFeD.js";import"./BetterPolymerElement-Dg3wVY7D.js";import"./tippy-tooltip-BFt4tVnx.js";class w extends d([p],o){static get template(){return l` 2 <style> 3 :host { 4 position: relative; 5 margin-bottom: 1.3em; 6 } 7 8 :host([invalid]) { 9 border: 1px solid var(--error-color) !important; 10 } 11 12 paper-input-error { 13 width: 100%; 14 } 15 </style> 16 17 <slot></slot> 18 19 <template is="dom-if" if="[[errorMessage]]"> 20 <paper-input-error invalid$="[[invalid]]" aria-live="assertive">[[errorMessage]]</paper-input-error> 21 </template> 22 `}static get properties(){return{required:Boolean,invalid:{type:Boolean,value:!1,reflectToAttribute:!0},errorMessage:String}}static get observers(){return["_handleSelectedUpdate(selectedItem, selectedItems)"]}isValid(){return{invalid:!(this.get("selectedItem")||this.get("selectedItems.length")>0),errorMessage:app._lang("someOptionMustBeSelected")}}_handleSelectedUpdate(e,t){this.get("invalid")&&(e||t.length>0)&&this.set("invalid",!1)}}window.customElements.define("paper-selector",w);class x extends h(f(o)){static get template(){return l` 23 ${super.template} 24 <style> 25 :host { 26 position: relative; 27 width: 100%; 28 height: 100%; 29 display: block; 30 } 31 32 section { 33 color: var(--on-background-color); 34 } 35 36 .entry { 37 padding: 25px 10px; 38 display: flex; 39 flex-wrap: wrap; 40 margin-bottom: 10px; 41 } 42 43 .entry > * { 44 flex: 1 1 400px; 45 padding: 0 1em; 46 } 47 48 h4 { 49 margin-bottom: 0; 50 } 51 52 paper-selector { 53 width: 100%; 54 border: 1px solid #ccc; 55 position: relative; 56 display: block; 57 } 58 59 .category { 60 padding: 8px; 61 position: relative; 62 display: flex; 63 align-items: center; 64 user-select: none; 65 } 66 67 .category iron-icon { 68 margin-right: 0.5em; 69 } 70 71 .hover-effect.iron-selected { 72 opacity: 0.8; 73 background: var(--application-color-light); 74 color: var(--on-application-color-light); 75 } 76 77 .hover-effect.iron-selected:hover { 78 opacity: 1; 79 background: var(--application-color) !important; 80 color: var(--on-application-color); 81 } 82 83 .iron-selected::before { 84 content: ""; 85 width: 10px; 86 height: 10px; 87 position: absolute; 88 left: -17px; 89 margin-top: 5px; 90 background-color: black; 91 -webkit-clip-path: polygon(50% 80%, 83% 41%, 99% 49%, 55% 100%, 55% 100%, 14% 72%, 25% 63%); 92 clip-path: polygon(50% 80%, 83% 41%, 99% 49%, 55% 100%, 55% 100%, 14% 72%, 25% 63%); 93 } 94 95 .iron-selected iron-icon { 96 fill: white; 97 } 98 99 .workspace { 100 display: flex; 101 flex-wrap: wrap; 102 margin-top: 1rem; 103 } 104 105 .workspace > *, 106 .workspace paper-material { 107 flex: 1 1 500px; 108 } 109 110 .workspace paper-material { 111 height: 80vh; 112 max-height: 80vh; 113 } 114 115 .workspace paper-material.source { 116 z-index: 1; 117 margin-right: 10px; 118 } 119 120 .workspace paper-material.result { 121 background: var(--surface-color); 122 padding: 1rem; 123 overflow: auto; 124 } 125 126 textarea { 127 width: 100%; 128 height: 100%; 129 padding: 1rem; 130 overflow: auto; 131 resize: none; 132 border: none; 133 outline: none; 134 background: var(--surface-color); 135 color: var(--on-surface-color); 136 } 137 138 .useful-links { 139 display: flex; 140 flex-direction: column; 141 } 142 143 .useful-links .link:hover { 144 color: var(--secondary-color); 145 } 146 147 .source-length { 148 text-align: left; 149 } 150 </style> 151 152 <page-toolbar 153 pending="[[or(loading, sending)]]" 154 error="[[error]]" 155 return-href="/changelog" 156 > 157 <paper-shrink-menu slot="action-buttons" show-labels> 158 <template is="dom-if" if="[[entryID]]"> 159 ${s.ACTION_BUTTON.delete({action:"_delete"})} 160 </template> 161 ${s.ACTION_BUTTON.save({action:"_save"})} 162 </paper-shrink-menu> 163 </page-toolbar> 164 165 <diamond-section-overlay loading="[[loading]]" error="[[error]]"></diamond-section-overlay> 166 167 <div class="content-wrap"> 168 <paper-material class="entry"> 169 <div> 170 <template is="dom-if" if="[[!isEqual(entryID, 0)]]"> 171 <paper-input label="[[_lang('createdOn')]]" value="[[millisecondsToDate(entry.createdOn)]]" readonly disabled></paper-input> 172 </template> 173 <paper-input label="[[_lang('versionText')]]*" value="{{entry.version}}" required></paper-input> 174 </div> 175 176 <div> 177 <h4>[[_lang('categories')]]*</h4> 178 <paper-selector id="selector" attr-for-selected="category" multi selected-values="{{entry.categories}}" required> 179 <template is="dom-repeat" items="[[changelogCategories]]"> 180 <div class="hover-effect category" category$="[[item]]"> 181 <iron-icon icon="[[getIconFromCategory(item)]]" style$="[[getStyleFromCategory(item)]]"></iron-icon> 182 <span>[[translateChangelogEntryCategory(item)]]</span> 183 </div> 184 </template> 185 </paper-selector> 186 </div> 187 </paper-material> 188 189 <section> 190 <paper-tabs class="sub section-control" selected="{{selectedLanguage}}" attr-for-selected="language-code" scrollable fit-container> 191 <template is="dom-repeat" items="[[availableLanguages]]" sort="_sortByLanguageCode"> 192 <paper-tab language-code$="[[item.languageCode]]">[[item.displayName]]</paper-tab> 193 </template> 194 </paper-tabs> 195 196 <div class="workspace"> 197 <div> 198 <paper-material class="source"> 199 <textarea id="input" value="[[_getTranslation(entry, selectedLanguage)]]" placeholder="Markdown" on-input="_handleTextareaInput" on-keydown="_handleTextareaKeyDown" maxlength="2000"></textarea> 200 </paper-material> 201 <div class="action-buttons" style="display: flex; justify-content: space-between"> 202 <p class="source-length">[[_getTranslationLength(entry, selectedLanguage)]] / 2000</p> 203 <paper-button class="no-style remove-button" on-click="_convertToHTML" style="margin-left: auto">[[_lang('convertToHTML')]]</paper-button> 204 </div> 205 </div> 206 <div> 207 <paper-material class="result"> 208 <markdown-frame src="[[_getTranslation(entry, selectedLanguage)]]" html="{{markdownHTML}}"></markdown-frame> 209 </paper-material> 210 <div class="action-buttons"> 211 <p id="resultCount">[[markdownHTML.length]]</p> 212 </div> 213 </div> 214 </div> 215 216 <div class="useful-links"> 217 <h4>[[_lang('usefulLinks')]]</h4> 218 <a class="link" target="_blank" rel="noreferrer noopener" href="https://www.markdownguide.org/basic-syntax/">Markdown basic syntax</a> 219 <a class="link" target="_blank" rel="noreferrer noopener" href="https://github.com/showdownjs/sh
219owdown/wiki/Showdown's-Markdown-syntax">Showdown's Markdown syntax</a> 220 </div> 221 </section> 222 </div> 223 `}static get properties(){return{as:{value:"entry"},changelogCategories:{type:Array,value:Object.values(u)},availableLanguages:Array,selectedLanguage:String,markdownHTML:String}}connectedCallback(){super.connectedCallback(),window.changelogEdit=this}init(e){super.init(e,!1),this.setProperties({availableLanguages:[],selectedLanguage:null}),this.getItemID?this.refresh():(this.updateRoute("changelog-creation"),this.refresh(this.clone(m)))}refresh(e){this.clearErrorFromResponse(),this.setLoading(!0),Promise.all([this.wrapWith("entry",e?Promise.resolve(e):n.getItemForEdit(this.getItemID)),this.wrapWith("languages",this._promiseGetLanguages())]).then(t=>t.forEach(a=>this.handleData(a)),t=>this.handleError(t)).finally(()=>this.handleFinally())}handleData(e){e.entry?super.handleData(e.entry):e.languages&&this.set("availableLanguages",e.languages)}handleGenericActionData(e,t,a,r){super.handleGenericActionData(e,"/changelog","/changelog","changelog")}setPageTitle(e){let t=i(e,"version");t&&this.updatePageTitleWithValue(`v${t}`)}_promiseGetLanguages(){return new Promise((e,t)=>{database.getData("languages")?e(database.getData("languages")):y.getList().then(a=>{database.setData("languages",a),c(this,()=>{this.setProperties({selectedLanguage:i(a,"0.languageCode","cs")})}),e(a)},a=>t(a))})}_save(){const e=t=>t&&!v.empty(t.text);this.get(`${this.alias}.text`).every(e)?this.checkMandatoryFields()?window.toaster.show(this._lang("allFieldsNotFill")):this.saveItem(t=>n.updateItem(t),t=>n.createItem(t)):window.toaster.show(this._lang("someTranslationMustBeValid"))}_delete(){this.deleteItem(e=>n.deleteItem(e),!0,this._lang("deleteEntry"),void 0,this._lang("versionText")+`: ${this.getItem.version}`)}_getTranslation(e,t){return e&&e.text&&(e.text.find(a=>a.language.languageCode==t)||{}).text||null}_getTranslationIndex(e,t){return e&&e.text?e.text.findIndex(a=>a.language.languageCode==t):-1}_getTranslationLength(e,t){return(this._getTranslation(e,t)||"").length}_sortByLanguageCode(e,t){return i(e,"languageCode",0)-i(t,"languageCode",0)}_handleTextareaKeyDown(e){if(e.key=="Tab"){e.preventDefault();let t=this.$.input,a=t.selectionStart,r=t.selectionEnd;a==r&&e.shiftKey?t.value.charAt(a-1)==" "&&(t.value=t.value.substring(0,a-1)+t.value.substring(r),t.selectionStart=t.selectionEnd=a-1):(t.value=t.value.substring(0,a)+" "+t.value.substring(r),t.selectionStart=t.selectionEnd=a+1)}this._handleTextareaInput(e)}_handleTextareaInput(e){let t=this._getTranslationIndex(this.getItem,this.selectedLanguage);t>-1?this.set(`${this.alias}.text.${t}.text`,e.target.value):this.set(`${this.alias}.text`,[...this.get(`${this.alias}.text`)||[],{language:this.get("availableLanguages").find(a=>a.languageCode==this.selectedLanguage),text:e.target.value}]),this.resetProperty(this.alias)}_convertToHTML(){if(this.markdownHTML.length>2e3){window.toaster.show({text:this._lang("htmlTooLongError",2e3),duration:8e3});return}window.confirmDialog({title:this._lang("convertToHTML"),message:this._lang("convertToHTMLMessage")}).then(()=>{let e=this._getTranslationIndex(this.getItem,this.selectedLanguage);this.set(`${this.alias}.text.${e}.text`,this.markdownHTML),this.resetProperty(this.alias)})}}window.customElements.define("changelog-edit",x); 224//# sourceMappingURL=changelog-edit-CDwTISYv.js.map
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.