Stylized new editor (#238)
Co-authored-by: Adam Bem <adam.bem@zoho.eu> Reviewed-on: #238 Reviewed-by: Mikolaj Widla <widlam@noreply.example.com>
This commit is contained in:
		| @@ -8,7 +8,7 @@ import SidebarComponent from '@components/sidebar/SidebarComponent.vue'; | |||||||
| <template> | <template> | ||||||
|   <div id="layout" class="flex h-screen bg-gradient-to-r from-white to-sky-200 dark:from-slate-800 dark:to-indigo-950"> |   <div id="layout" class="flex h-screen bg-gradient-to-r from-white to-sky-200 dark:from-slate-800 dark:to-indigo-950"> | ||||||
|     <SidebarComponent /> |     <SidebarComponent /> | ||||||
|     <div class="relative p-6 w-full m-4 bg-blue-50 dark:bg-gray-700 rounded-2xl overflow-hidden shadow-lg"> |     <div class="relative p-4 w-full m-4 bg-blue-50 dark:bg-gray-700 rounded-2xl overflow-hidden shadow-lg"> | ||||||
|       <RouterView></RouterView> |       <RouterView></RouterView> | ||||||
|     </div> |     </div> | ||||||
|   </div> |   </div> | ||||||
|   | |||||||
| @@ -55,10 +55,10 @@ import {html} from '@codemirror/lang-html' | |||||||
| </script> | </script> | ||||||
|  |  | ||||||
| <template> | <template> | ||||||
|     <div class="editor h-full overflow-scroll"> |   <div class="editor w-full max-w-full h-full overflow-scroll"> | ||||||
|      |      | ||||||
|     <codemirror |     <codemirror | ||||||
|       style="height: 100%; padding:0.5rem ; border-radius: 0.5rem" |       style="height: 100%; width: 100%; padding:1rem ; border-radius: 1rem; font-size: large;" | ||||||
|       :model-value="code" |       :model-value="code" | ||||||
|       @update:model-value="dataUpdated" |       @update:model-value="dataUpdated" | ||||||
|       :extensions="extensions" |       :extensions="extensions" | ||||||
|   | |||||||
| @@ -34,9 +34,9 @@ function showHeaders(headers: object, index: number){ | |||||||
|  |  | ||||||
|  |  | ||||||
| <template> | <template> | ||||||
|     <div class="w-full xl:w-5/12 flex flex-col gap-y-4"> |     <div class="w-full xl:w-2/5 flex flex-none flex-col gap-y-4"> | ||||||
|     <HistoryRecords class="xl:h-1/3 overflow-y-scroll" @click:show-headers="showHeaders" @click:show-body="showBody"></HistoryRecords> |         <HistoryRecords class="xl:h-1/3 overflow-y-scroll" @click:show-headers="showHeaders" @click:show-body="showBody"></HistoryRecords> | ||||||
|     <BodyDetailComponent :content-type="currentContentType" :data="currentShownData" v-if="shownDetail == 'body' "></BodyDetailComponent> |         <BodyDetailComponent :content-type="currentContentType" :data="currentShownData" v-if="shownDetail == 'body' "></BodyDetailComponent> | ||||||
|     <HeadersDetailComponent :data="currentShownData"  v-if="shownDetail == 'headers' "></HeadersDetailComponent> |         <HeadersDetailComponent :data="currentShownData"  v-if="shownDetail == 'headers' "></HeadersDetailComponent> | ||||||
|     </div> |     </div> | ||||||
| </template> | </template> | ||||||
| @@ -44,7 +44,7 @@ function showUpdatedCode(newCode : string){ | |||||||
| </script> | </script> | ||||||
|  |  | ||||||
| <template> | <template> | ||||||
|   <div class="flex flex-col w-full xl:w-3/5 text-center dark:text-white gap-6 p-1"> |   <div class="flex flex-col flex-none w-full xl:w-3/5 text-center dark:text-white gap-6 p-1"> | ||||||
|     <div class="flex flex-col md:flex-row gap-4 items-center md:justify-stretch md:items-end"> |     <div class="flex flex-col md:flex-row gap-4 items-center md:justify-stretch md:items-end"> | ||||||
|       <div class="flex flex-col w-full"> |       <div class="flex flex-col w-full"> | ||||||
|         <label for="link">Link</label><br/> |         <label for="link">Link</label><br/> | ||||||
|   | |||||||
| @@ -42,16 +42,15 @@ function canBeFormatted() { | |||||||
| </script> | </script> | ||||||
|  |  | ||||||
| <template> | <template> | ||||||
|     <div class="flex flex-col w-full h-1/2"> |     <div class="flex flex-col w-full h-1/2 lg:h-1/2 flex-none pr-4 pb-2"> | ||||||
|         <div class="flex place-content-between w-full pr-2 items-center m-2"> |         <div class="flex place-content-between w-full items-center"> | ||||||
|             <span class="dark:text-white">{{ stylizedName }}</span> |             <span class="dark:text-white">{{ stylizedName }}</span> | ||||||
|             <div class="flex space-x-2"> |             <div class="flex space-x-2 pb-2"> | ||||||
|                 <InsertTemplateComponent :stylized-name="props.stylizedName" @update:default-data="(data: string) => updateData(data)"></InsertTemplateComponent> |                 <InsertTemplateComponent :stylized-name="props.stylizedName" @update:default-data="(data: string) => updateData(data)"></InsertTemplateComponent> | ||||||
|                 <XMLButtonFormatterComponent v-if="canBeFormatted()" :xml="data" @update:result="(data:any) => updateData(data.result)"></XMLButtonFormatterComponent> |                 <XMLButtonFormatterComponent v-if="canBeFormatted()" :xml="data" @update:result="(data:any) => updateData(data.result)"></XMLButtonFormatterComponent> | ||||||
|                 <button class="tool-button" @click="clear">Clear</button> |                 <button class="tool-button" @click="clear">Clear</button> | ||||||
|             </div> |             </div> | ||||||
|         </div> |         </div> | ||||||
|         <!-- <textarea id="xmlField" v-model="data" @input="sendValue()" class="text-field h-full"></textarea> --> |  | ||||||
|         <CodeEditor @update:updated-code="sendNewValue" v-model="data" :code="data" :config="{disabled:false, language:stylizedName}"></CodeEditor> |         <CodeEditor @update:updated-code="sendNewValue" v-model="data" :code="data" :config="{disabled:false, language:stylizedName}"></CodeEditor> | ||||||
|     </div> |     </div> | ||||||
| </template> | </template> | ||||||
| @@ -129,8 +129,8 @@ function emitVersionChange() { | |||||||
| </script> | </script> | ||||||
|  |  | ||||||
| <template> | <template> | ||||||
|     <div class="flex flex-col w-full lg:w-1/2 h-1/2 lg:h-full items-center"> |     <div class="flex flex-col flex-none w-full lg:w-1/2 h-1/3 lg:h-full items-center pb-2 pr-2"> | ||||||
|         <div class="flex place-content-between w-full items-center m-2"> |         <div class="flex place-content-between w-full items-center pb-2"> | ||||||
|             <span class="dark:text-white">Result:</span> |             <span class="dark:text-white">Result:</span> | ||||||
|             <div class="flex space-x-2"> |             <div class="flex space-x-2"> | ||||||
|                 <select v-model="engine" name="engine" @change="changeAvailableVersions()" class="px-3 rounded-full border border-slate-400 bg-white dark:text-slate-100 dark:bg-gray-600"> |                 <select v-model="engine" name="engine" @change="changeAvailableVersions()" class="px-3 rounded-full border border-slate-400 bg-white dark:text-slate-100 dark:bg-gray-600"> | ||||||
| @@ -143,8 +143,7 @@ function emitVersionChange() { | |||||||
|                 <button class="tool-button" @click="process">Process</button> |                 <button class="tool-button" @click="process">Process</button> | ||||||
|             </div> |             </div> | ||||||
|         </div> |         </div> | ||||||
|         <div class="text-field overflow-scroll h-full w-full"> |         <div class="overflow-scroll h-full w-full"> | ||||||
|             <!--  <pre class="whitespace-pre-wrap"><code>{{ result }}</code></pre>  --> |  | ||||||
|             <CodeEditor :code="result" :config="{disabled:true,language:tool}"></CodeEditor> |             <CodeEditor :code="result" :config="{disabled:true,language:tool}"></CodeEditor> | ||||||
|         </div> |         </div> | ||||||
|          |          | ||||||
|   | |||||||
| @@ -38,7 +38,7 @@ function toggleTooltips() { | |||||||
| </script> | </script> | ||||||
|  |  | ||||||
| <template> | <template> | ||||||
|     <div :class="{ 'w-4/12' : !areTooltipsHidden }" class="hidden xl:flex shrink-0 items-stretch p-2 flex-row rounded-xl shadow-lg bg-gradient-to-r from-blue-400 to-blue-300 dark:from-sky-600 dark:to-sky-800"> |     <div :class="areTooltipsHidden ? 'w-fit' : 'w-4/12'" class="hidden 2xl:flex shrink-0 items-stretch p-2 flex-row rounded-xl shadow-lg bg-gradient-to-r from-blue-400 to-blue-300 dark:from-sky-600 dark:to-sky-800"> | ||||||
|         <button :class="{'mr-2' : !areTooltipsHidden }" class="text-xl w-6 dark:text-slate-100" @click="toggleTooltips()"> |         <button :class="{'mr-2' : !areTooltipsHidden }" class="text-xl w-6 dark:text-slate-100" @click="toggleTooltips()"> | ||||||
|             T<br/>o<br/>o<br/>l<br/>t<br/>i<br/>p<br/>s |             T<br/>o<br/>o<br/>l<br/>t<br/>i<br/>p<br/>s | ||||||
|         </button> |         </button> | ||||||
|   | |||||||
| @@ -16,12 +16,14 @@ function updateVersion(newVersion: string) { | |||||||
| </script> | </script> | ||||||
|  |  | ||||||
| <template> | <template> | ||||||
|     <div id="layout" class="flex flex-col lg:flex-row w-full h-full gap-4"> |     <div id="layout" class="flex flex-col lg:flex-row w-full h-full"> | ||||||
|         <div class="flex flex-col w-full lg:w-1/2 h-full items-center gap-4"> |         <div class="flex flex-col lg:flex-row w-full lg:w-7/12 grow overflow-hide px-2"> | ||||||
|             <xmlInputFieldComponent stylized-name="XML" :data="xml" @update="(data) => {xml = data}"></xmlInputFieldComponent> |             <div class="flex flex-col w-full lg:w-1/2 h-2/3 lg:h-full flex-none items-center"> | ||||||
|             <xmlInputFieldComponent stylized-name="XPath" :data="query" @update="(data) => {query = data}"></xmlInputFieldComponent> |                 <xmlInputFieldComponent stylized-name="XML" :data="xml" @update="(data) => {xml = data}"></xmlInputFieldComponent> | ||||||
|  |                 <xmlInputFieldComponent stylized-name="XPath" :data="query" @update="(data) => {query = data}"></xmlInputFieldComponent> | ||||||
|  |             </div> | ||||||
|  |             <xmlOutputFieldComponent tool="xpath" :xml="xml" :query="query" @update="(version) => updateVersion(version)"></xmlOutputFieldComponent> | ||||||
|         </div> |         </div> | ||||||
|         <xmlOutputFieldComponent tool="xpath" :xml="xml" :query="query" @update="(version) => updateVersion(version)"></xmlOutputFieldComponent> |  | ||||||
|         <tooltipComponent :version="version"></tooltipComponent> |         <tooltipComponent :version="version"></tooltipComponent> | ||||||
|     </div> |     </div> | ||||||
| </template> | </template> | ||||||
| @@ -10,8 +10,8 @@ const query = ref(''); | |||||||
| </script> | </script> | ||||||
|  |  | ||||||
| <template> | <template> | ||||||
|     <div id="layout" class="flex flex-col lg:flex-row w-full h-full gap-4"> |     <div id="layout" class="flex flex-col lg:flex-row w-full h-full"> | ||||||
|         <div class="flex flex-col w-full lg:w-1/2 h-full items-center gap-4"> |         <div class="flex flex-col w-full lg:w-1/2 h-2/3 lg:h-full flex-none items-center"> | ||||||
|             <xmlInputFieldComponent stylized-name="XML" @update="(data) => {xml = data}"></xmlInputFieldComponent> |             <xmlInputFieldComponent stylized-name="XML" @update="(data) => {xml = data}"></xmlInputFieldComponent> | ||||||
|             <xmlInputFieldComponent stylized-name="XQuery" @update="(data) => {query = data}"></xmlInputFieldComponent> |             <xmlInputFieldComponent stylized-name="XQuery" @update="(data) => {query = data}"></xmlInputFieldComponent> | ||||||
|         </div> |         </div> | ||||||
|   | |||||||
| @@ -10,8 +10,8 @@ const query = ref(''); | |||||||
| </script> | </script> | ||||||
|  |  | ||||||
| <template> | <template> | ||||||
|     <div id="layout" class="flex flex-col lg:flex-row w-full h-full gap-4"> |     <div id="layout" class="flex flex-col lg:flex-row w-full h-full"> | ||||||
|         <div class="flex flex-col w-full lg:w-1/2 h-full items-center gap-4"> |         <div class="flex flex-col w-full lg:w-1/2 h-2/3 lg:h-full flex-none items-center"> | ||||||
|             <xmlInputFieldComponent stylized-name="XML" @update="(data) => {xml = data}"></xmlInputFieldComponent> |             <xmlInputFieldComponent stylized-name="XML" @update="(data) => {xml = data}"></xmlInputFieldComponent> | ||||||
|             <xmlInputFieldComponent stylized-name="XSD" @update="(data) => {query = data}"></xmlInputFieldComponent> |             <xmlInputFieldComponent stylized-name="XSD" @update="(data) => {query = data}"></xmlInputFieldComponent> | ||||||
|         </div> |         </div> | ||||||
|   | |||||||
| @@ -10,8 +10,8 @@ const query = ref(''); | |||||||
| </script> | </script> | ||||||
|  |  | ||||||
| <template> | <template> | ||||||
|     <div id="layout" class="flex flex-col lg:flex-row w-full h-full gap-4"> |     <div id="layout" class="flex flex-col lg:flex-row w-full h-full"> | ||||||
|         <div class="flex flex-col w-full lg:w-1/2 h-full items-center gap-4"> |         <div class="flex flex-col w-full lg:w-1/2 h-2/3 lg:h-full flex-none items-center"> | ||||||
|             <xmlInputFieldComponent stylized-name="XML" @update="(data) => {xml = data}"></xmlInputFieldComponent> |             <xmlInputFieldComponent stylized-name="XML" @update="(data) => {xml = data}"></xmlInputFieldComponent> | ||||||
|             <xmlInputFieldComponent stylized-name="XSLT" @update="(data) => {query = data}"></xmlInputFieldComponent> |             <xmlInputFieldComponent stylized-name="XSLT" @update="(data) => {query = data}"></xmlInputFieldComponent> | ||||||
|         </div> |         </div> | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user