Skip to content

Commit

Permalink
fix quite problem added tinymce for content editable divs
Browse files Browse the repository at this point in the history
  • Loading branch information
SDClowen committed Aug 2, 2024
1 parent a3610dc commit fd31133
Show file tree
Hide file tree
Showing 11 changed files with 176 additions and 81 deletions.
2 changes: 1 addition & 1 deletion app/views/auth-pin.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<title>Surmey - Validate Pin</title>
{acss("app")|noescape}
{njs("jquery/dist/jquery.min")|noescape}
{njs("sdeasy/sdeasy")|noescape}
{njs("sdpower/sdeasy")|noescape}
<script src="https://cdn.jsdelivr.net/gh/alpinejs/[email protected]/dist/alpine.min.js" defer></script>
<script defer src="https://cdn.jsdelivr.net/npm/@alpinejs/[email protected]/dist/cdn.min.js"></script>
Expand Down
32 changes: 17 additions & 15 deletions app/views/auth.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,21 +8,21 @@
<title>Surmey - {$title}</title>
{acss("app")|noescape}
{njs("jquery/dist/jquery.min")|noescape}
{njs("sdeasy/sdeasy")|noescape}
{njs("sdpower/sdeasy")|noescape}
</head>
<body class="flex flex-wrap min-h-screen w-full content-center justify-center bg-gray-200 dark:bg-slate-700 dark:text-gray-200 py-10">
<!-- Login component -->
<div class="flex shadow-md relative">
<!-- Login form -->
<div class="auth-message absolute bottom-0 w-4/5 ml-5"></div>
<div class="flex flex-wrap content-center justify-center rounded-l-md bg-white dark:bg-slate-900" style="width: 24rem; height: 32rem;">
<div class="flex shadow-md relative overflow-hidden rounded-xl">
<div class="message absolute bottom-0 w-4/5 ml-5"></div>
<div class="flex flex-wrap content-center justify-center bg-white dark:bg-slate-900" style="width: 24rem; height: 32rem;">
<div width="192" class="text-black dark:text-white mb-14 mx-auto min-[980px]:hidden">
{include '..\..\public\images\logo.svg'}
</div>
<div class="w-72">
<!-- Heading -->
<h1 class="text-xl font-semibold">Welcome back</h1>
<small class="text-gray-400">Please enter your details</small>
<h1 class="text-xl font-semibold">Hoşgeldiniz</h1>
<small class="text-gray-400">Lütfen Giriş Bilgilerinizi Girin</small>
<form role="form" class="space-y-6" action="/auth" method="post" data-content=".auth-message">
<form role="form" class="space-y-6" action="/auth" method="post" data-content=".message">
{csrf()|noescape}
<div class="mb-3">
<label class="mb-2 block text-xs font-semibold">{lang("username.or.email")}</label>
Expand All @@ -40,14 +40,14 @@
</div>
<div class="mb-3">
<button type="submit" class="mb-1.5 block w-full text-center text-white bg-blue-700 hover:bg-blue-900 transition-colors transition-duration-200 px-2 py-1.5 rounded-md">Sign in</button>
<button type="submit" class="mb-1.5 block w-full text-center text-white bg-blue-600 hover:bg-blue-800 transition-colors transition-duration-200 px-2 py-1.5 rounded-md">Sign in</button>
</div>
</form>
</div>
</div>
<div class="flex flex-wrap content-center justify-center rounded-r-md" style="width: 24rem; height: 32rem;">
<img id="loginImage" class="w-full h-full bg-center bg-no-repeat bg-cover rounded-r-md" src="https://i.imgur.com/WqEWifN.jpeg">
<div class="bg-white text-black flex flex-wrap content-center justify-center max-[980px]:hidden" style="width: 24rem; height: 32rem;">
<img id="loginImage" class="w-full h-full bg-center bg-no-repeat bg-cover rounded-r-md" src="">
</div>
</div>
Expand All @@ -66,9 +66,11 @@
"https://i.imgur.com/WqEWifN.jpeg"
]
const domImage = document.querySelector("#loginImage");
const domImage = document.querySelectorAll("#loginImage");
if (domImage) {
domImage.src = images[Math.floor(Math.random() * 3)]
domImage.forEach((element, key) =>{
element.src = images[Math.floor(Math.random() * 3)]
})
}
</script>
Expand Down
2 changes: 1 addition & 1 deletion app/views/main.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
{acss("app")|noescape}
{njs("jquery/dist/jquery.min")|noescape}
{njs("sdeasy/sdeasy")|noescape}
{njs("sdpower/sdeasy")|noescape}
{ajs("app")|noescape}
</head>
Expand Down
189 changes: 139 additions & 50 deletions app/views/survey-crud.php

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion app/views/survey/auth.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
{acss("app")|noescape}
{njs("jquery/dist/jquery.min")|noescape}
{ajs("jquery.inputmask.min")|noescape}
{njs("sdeasy/sdeasy")|noescape}
{njs("sdpower/sdeasy")|noescape}
<script>
$(function () {
$(":input[name=phone]").inputmask({ "mask": "(999) 999 99 99" });
Expand Down
2 changes: 1 addition & 1 deletion app/views/survey/participate.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
{acss("app")|noescape}
{njs("jquery/dist/jquery.min")|noescape}
{njs("sdeasy/sdeasy")|noescape}
{njs("sdpower/sdeasy")|noescape}
{ajs("app")|noescape}
</head>
Expand Down
2 changes: 1 addition & 1 deletion app/views/survey/pin.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<title>Surmey - {$title}</title>
{acss("app")|noescape}
{njs("jquery/dist/jquery.min")|noescape}
{njs("sdeasy/sdeasy")|noescape}
{njs("sdpower/sdeasy")|noescape}
<script src="https://cdn.jsdelivr.net/gh/alpinejs/[email protected]/dist/alpine.min.js" defer></script>
<script defer src="https://cdn.jsdelivr.net/npm/@alpinejs/[email protected]/dist/cdn.min.js"></script>
Expand Down
2 changes: 1 addition & 1 deletion app/views/survey/results.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
{acss("app")|noescape}
{njs("jquery/dist/jquery.min")|noescape}
{ajs("jquery.inputmask.min")|noescape}
{njs("sdeasy/sdeasy")|noescape}
{njs("sdpower/sdeasy")|noescape}
<script>
$(function () {
Expand Down
2 changes: 1 addition & 1 deletion app/views/survey/view.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
<link href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-9ndCyUaIbzAi2FUVXJi0CjmCapSmO7SnpJef0486qhLnuZ2cdeRhO02iuK6FUUVM" crossorigin="anonymous">
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.bundle.min.js" integrity="sha384-geWF76RCwLtnZ8qwWowPQNguL3RmwHVBC9FhGdlKrxdiJJigb/j/68SIy3Te4Bkz" crossorigin="anonymous"></script>
<script src="https://code.jquery.com/jquery-3.7.0.min.js"></script>
{njs("sdeasy/sdeasy")|noescape}
{njs("sdpower/sdeasy")|noescape}
<style>
.form-check-input {
min-width: 1em;
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@
"@tinymce/tinymce-jquery": "^2.1.0",
"fs-extra": "^11.1.1",
"jquery": "^3.7.0",
"sdeasy": "^1.0.1",
"tinymce": "^6.6.0"
"sdpower": "^1.0.1",
"tinymce": "^7.2.1"
},
"main": "tailwind.config.js",
"scripts": {
Expand Down
18 changes: 11 additions & 7 deletions public/js/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ $(function () {
});*/

function linkify(text) {

return text;

var urlRegex = /(\b(https?|ftp|file):\/\/[-A-Z0-9+&@#\/%?=~_|!:,.;]*[-A-Z0-9+&@#\/%=~_|])/ig;
return text.replace(urlRegex, function (url) {
return '<a class="text-blue-600 underline" href="' + url + '">' + url + '</a>';
Expand All @@ -29,10 +32,11 @@ $(function () {
const clearText = (text) => {
return text
.trim()
.replace("\r\n", "<br>")
.replace("\r", "<br/>")
.replace("\n", "<br>")
.replace("\t", " ");
.replaceAll("\r\n", "<br>")
.replaceAll("\r", "<br/>")
.replaceAll("\n", "<br>")
.replaceAll("\t", " ")
.replaceAll('"', '\\\"');
};

$("body").on("change", "#file-upload", function (event) {
Expand Down Expand Up @@ -367,7 +371,7 @@ $(function () {
if (element.type != "description")
content += `
<h1 class="text-clip border-b border-gray-200 pb-3 pt-1 text-lg font-medium dark:border-gray-600 mb-4">
${linkify(element.title)} ${element.isRequired ? "<b class='text-red-600'>*</b>" : ""}
${linkify(element.title.replaceAll('\\\"', '"'))} ${element.isRequired ? "<b class='text-red-600'>*</b>" : ""}
</h1>
`;

Expand All @@ -386,7 +390,7 @@ $(function () {
const types = ["info", "warning", "success", "danger"];
content += `
<div data-slug="${element.slug}" class="my-3 shadow-sm text-center rounded-md p-3 text-md alert-${types[element.subType]}">
${linkify(element.title)}
${linkify(element.title.replaceAll('\\\"', '"'))}
</div>
`;
break;
Expand All @@ -400,7 +404,7 @@ $(function () {
content += `
<div class="flex w-fit items-center mb-2 mx-1">
<input data-condition="${hasCondition}" data-change-tracker="true" id="link-${element.slug + i}" name="${element.type == "radio" ? element.slug : element.slug + i}" type="${element.type}" value="${i}" class="w-4 h-4 text-blue-600 bg-gray-100 border-gray-300 focus:ring-blue-500 dark:focus:ring-blue-600 dark:ring-offset-gray-800 focus:ring-2 dark:bg-gray-700 dark:border-gray-600">
<label for="link-${element.slug + i}" class="ml-2 text-sm font-normal text-gray-900 dark:text-gray-300" ${element.isHorizontal ? 'style="min-inline-size: max-content;"' : ''}>${linkify(answer)}</label>
<label for="link-${element.slug + i}" class="ml-2 text-sm font-normal text-gray-900 dark:text-gray-300" ${element.isHorizontal ? 'style="min-inline-size: max-content;"' : ''}>${linkify(answer.replaceAll('\\\"', '"'))}</label>
</div>
`;
});
Expand Down

0 comments on commit fd31133

Please sign in to comment.