pull/14/head
Suvodip 2024-12-25 17:50:40 +05:30
parent 501d623e74
commit aa252de5c9
11 changed files with 723 additions and 2 deletions

View File

@ -39,7 +39,7 @@
if (isset($content[0]['content']) && $content[0]['content']) {
$pageContent = '
<div class="container mx-auto" style="">
<div class="container mx-auto" style="display: flex; flex-direction: column; justify-content: center; align-items: center;">
<div class="" style="padding-top:20px; padding-bottom:15px; font-size:25px;">
<p style="text-align: center;">' . htmlspecialchars($content[0]['title']) . '</p>
</div>
@ -50,7 +50,7 @@
saveHtmlFile($fileName, $headerContent, $pageContent);
} else {
$pageContent = '
<div style="display: flex; flex-direction: column; align-items: center; justify-content: center; margin: 100px 0;">
<div style="display: flex; flex-direction: column; align-items: center; justify-content: center; margin: 100px 0; ">
<p style="text-align: center; font-size: 30px; font-weight: bold;">Page not found (404).</p>
<a href="/">Back to home</a>
</div>';

20
.hta_admin_header.php Normal file
View File

@ -0,0 +1,20 @@
<div id="adminHeader" style="">
<a id="adminHeaderLink" href="/admin/add-content.php">Add Content</a>
<!-- <a id="adminHeaderLink" href="">Edit Content</a> -->
<a id="adminHeaderLink" href="/admin/page-list.php">Page Content List</a>
<a id="adminHeaderLink" href="/admin/file-list.php">File List</a>
</div>
<style>
#adminHeader{
display: flex;
background-color: #ffddcc;
width: 100%; margin: auto;
padding: 10px;
justify-content: center;
gap: 20px;
}
#adminHeaderLink{
color: #402517;
text-decoration: none;
}
</style>

143
admin/add-content.php Normal file
View File

@ -0,0 +1,143 @@
<?php
require('../.hta_config/env.php');
require('../.hta_header.php');
require('../.hta_admin_header.php');
$current_date_time = date("Y-m-d H:i:s");
if(isset($_POST['title'])){
try {
$db = new PDO("mysql:host=$mariaServer;dbname=$mariaDb", $mariaUser, $mariaPass);
$db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); // Set the PDO error mode to exception
$stmt = $db->prepare("INSERT INTO scc24 (date_created, type, title, slug, content) VALUES (:date_created, :type, :title, :slug, :content)");
$stmt->bindParam(':date_created', $current_date_time);
$stmt->bindParam(':type', $_POST['type']);
$stmt->bindParam(':title', $_POST['title']);
$stmt->bindParam(':slug', $_POST['slug']);
$stmt->bindParam(':content', $_POST['content']);
if ($stmt->execute()) {
echo 'New '.$_POST['type'].' created.';
} else {
echo "Error executing statement: " . $stmt->errorInfo()[2]; // need to implement this Err. check specially for new entry to mariaDB
}
}catch (PDOException $e) {
// echo 'errorID:3001: "New Registration Server" busy!';
echo "Error: " . $e->getMessage();
};
}
?>
<div id="createNewPage" >
<h3 style="text-align: center; margin: 10px 0;">Create New Page or Notice</h3>
<form id="createNewPageForm" method="POST" enctype="multipart/form-data">
<label for="type">Select Type</label>
<select name="type" id="type" style="padding: 10px;">
<option value="0">-Select-</option>
<option value="notice">Notice</option>
<option value="tender">Tender</option>
<option value="page">Page</option>
<option value="documents">Documents</option>
<option value="events">Events</option>
</select><br/>
<label for="title">Page Title:</label><br> <input id="title" name="title" type="text">
<label for="slug">Page unique slug:</label><br> <input id="slug" name="slug" type="text">
<label for="editor">Content:</label>
<div style="color: #000;" id="editor"></div>
<div id="markup"></div>
<textarea name="content" id="content" rows="" col="0" class="border-2 border-primary p-2 rounded" style="visibility: hidden; height: 2px;"></textarea>
<!-- <div id="yseditor"></div> -->
<!-- <label for="content">Page Content:</label><br> <textarea id="pageContent" name="content"> </textarea> -->
<!-- <input type="submit" name="createNew" value="Save"> -->
<!-- <input type="hidden" name="content" value="" id="content" > -->
<button type="submit" id="createButton" type="button" >Create New Page</button>
</form>
</div>
<link rel="stylesheet" type="text/css" href="/assets/pell.css">
<script src="/assets/pell.js"></script>
<script>
const pell = window.pell;
const editor = document.getElementById("editor");
const markup = document.getElementById("markup");
let contentTextArea = document.getElementById('content');
pell.init({
element: editor,
onChange: (html) => {
markup.innerHTML = "HTML Output: <br /><br />";
markup.innerText += html;
contentTextArea.value = html;
// console.log(html)
}
})
function slugify(text) {
return text.toString().toLowerCase()
.replace(/\s+/g, '-') // Replace spaces with -
.replace(/[^\w\-]+/g, '') // Remove all non-word chars
.replace(/\-\-+/g, '-') // Replace multiple - with single -
.replace(/^-+/, '') // Trim - from start of text
.replace(/-+$/, ''); // Trim - from end of text
}
window.onload = function() {
var inputField = document.getElementById('title');
var slugField = document.getElementById('slug');
inputField.addEventListener('input', function() {
var inputText = inputField.value;
var slugText = slugify(inputText);
slugField.value = slugText;
});
};
</script>
<style>
#createNewPage {
padding: 10px 50px;
margin: 10px auto;
background-color: #ffddcc;
border-radius: 20px;
width: 100%;
max-width: 60%;
}
/* For mobile screens */
@media (max-width: 768px) {
#createNewPage {
max-width: 100%;
width: 100%;
padding: 10px 20px; /* Optional: adjust padding for smaller screens */
}
}
#createNewPage > form > input, select {
width:100%;
/* margin-top:10px; */
margin-bottom:10px;
padding: 10px;
border-radius: 6px;
}
#createNewPage > form > textarea{
width:100%;
margin:10px;
height:200px;
}
#createButton{
background-color: #402517;
color: #FFFFFF;
border-radius: 10px;
padding: 10px;
outline: none;
border: none;
display: flex;
}
.pell-content{
background: #fff;
border-bottom: 1px solid black;
}
</style>
<?php
require('../.hta_footer.php');
?>

149
admin/edit-content.php Normal file
View File

@ -0,0 +1,149 @@
<?php
require('../.hta_config/env.php');
require('../.hta_header.php');
require('../.hta_admin_header.php');
$current_date_time = date("Y-m-d H:i:s");
?>
<style>
#createNewPage {
padding: 10px 50px;
margin: 10px auto;
background-color: #ffddcc;
border-radius: 20px;
width: 100%;
max-width: 60%;
}
/* For mobile screens */
@media (max-width: 768px) {
#createNewPage {
max-width: 100%;
width: 100%;
padding: 10px 20px; /* Optional: adjust padding for smaller screens */
}
}
#createNewPage > form > input, select {
width:100%;
/* margin-top:10px; */
margin-bottom:10px;
padding: 10px;
border-radius: 6px;
}
#createNewPage > form > textarea{
width:100%;
margin:10px;
height:200px;
}
#createButton{
background-color: #402517;
color: #FFFFFF;
border-radius: 10px;
padding: 10px;
outline: none;
border: none;
display: flex;
}
.pell-content{
background: #fff;
border-bottom: 1px solid black;
}
</style>
<link rel="stylesheet" type="text/css" href="/assets/pell.css">
<script src="/assets/pell.js"></script>
<?php
$getID = $_GET['id'];
if ($_SERVER['REQUEST_METHOD'] === 'POST') {
try {
$conn = new PDO("mysql:host=$mariaServer;dbname=$mariaDb", $mariaUser, $mariaPass);
$conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
$stmt = $conn->prepare("UPDATE scc24 SET `type` = :type, `title` = :title, `slug` = :slug, `content` = :content WHERE `id` = :getID");
$stmt->bindParam(':getID', $getID);
$stmt->bindParam(':type', $_POST['type']);
$stmt->bindParam(':title', $_POST['title']);
$stmt->bindParam(':slug', $_POST['slug']);
$stmt->bindParam(':content', $_POST['content']);
$stmt->execute();
// echo "<script>window.location.href='edit-news-list';</script>";
} catch (PDOException $e) {
echo "Err: " . $e->getMessage();
}
}
?>
<?php
try {
$db = new PDO("mysql:host=$mariaServer;dbname=$mariaDb", $mariaUser, $mariaPass);
$db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
$stmt = $db->prepare("SELECT * FROM scc24 WHERE `id` = :id");
$stmt->bindParam(':id', $getID);
$stmt->execute();
$rows = $stmt->fetchAll(PDO::FETCH_ASSOC);
foreach($rows as $row){
echo ' <div id="createNewPage" >
<h3 style="text-align: center; margin: 10px 0;">Edit New Page or Notice</h3>
<form id="createNewPageForm" method="POST" enctype="multipart/form-data">
<label for="type">Select Type</label>';
?>
<select name="type" id="type" style="padding: 10px;">
<?php
// echo $row['type'];
$typeOptions = ['notice', 'tender', 'page', 'documents', 'events'];
foreach($typeOptions as $type){
$selected = ($row['type'] === $type) ? 'selected' : '';
echo '<option value="'.$type.'" '.$selected.'>'.ucfirst($type).'</option>';
}
?>
</select><br/>
<?php
echo '
<label for="title">Page Title:</label><br> <input id="title" name="title" type="text" value="'.$row['title'].'" />
<label for="slug">Page unique slug:</label><br> <input id="slug" name="slug" type="text" value="'.$row['slug'].'" />
<label for="editor">Content:</label>
<div style="color: #000;" id="editor"></div>
<textarea name="content" id="content" rows="" col="0" class="border-2 border-primary p-2 rounded" style="visibility: hidden; height: 10px;"></textarea>
<button type="submit" id="createButton" type="button" > &nbsp; Save &nbsp; </button>
</form>
</div>';
echo '<script>
window.onload = function() {
getTypeValue(); // Call the function on window load
};
const pell = window.pell;
const editor = document.getElementById("editor");
let contentTextArea = document.getElementById(\'content\');
// Initialize pell editor and assign the return value to editorInstance
let editorInstance = pell.init({
element: editor,
onChange: (html) => {
console.log(html);
contentTextArea.value = html;
}
});
// Function to update editor content dynamically
function updateEditorContent(newContent) {
editorInstance.content.innerHTML = newContent;
// Trigger change event to update contentTextArea
contentTextArea.value = newContent;
}
// Example usage:
updateEditorContent(' . json_encode($row['content']) . ');
</script>';
};
// exit();
} catch (PDOException $e) {
echo json_encode(array('success' => false, 'message' => 'Database error: ' . $e->getMessage()));
}
?>
<?php
require('../.hta_footer.php');
?>

324
admin/file-list.php Normal file
View File

@ -0,0 +1,324 @@
<?php
require('../.hta_config/env.php');
require('../.hta_header.php');
require('../.hta_admin_header.php');
$current_date_time = date("Y-m-d H:i:s");
$home_uri_for_file_link = $_SERVER['HTTP_HOST'];
if ($_SERVER['REQUEST_METHOD'] === 'POST') {
if (isset($_FILES['file']) && $_FILES['file']['error'] === UPLOAD_ERR_OK) {
$target_dir = $_SERVER['DOCUMENT_ROOT'] . "/assets/uploaded-file/"; // Full path to assets folder
$desc_txt = $_POST['desc_txt']; // ALT text
$file_name = $_FILES['file']['name']; // Original file name
$file_tmp = $_FILES['file']['tmp_name']; // Temporary file path
if (file_exists($file_tmp)) {
$mimeType = mime_content_type($file_tmp); // Get the mime type of the file
if (!file_exists($target_dir)) {
mkdir($target_dir, 0777, true); // Create the directory if it doesn't exist
}
$target_file = $target_dir . basename($file_name);
if (move_uploaded_file($file_tmp, $target_file)) {
$file_url = "/assets/uploaded-file/" . basename($file_name); // URL of the uploaded file
try {
$conn = new PDO("mysql:host=$mariaServer;dbname=$mariaDb", $mariaUser, $mariaPass);
$conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
$stmt = $conn->prepare("INSERT INTO scc_files (link, alt, file_name) VALUES (:link, :alt, :file_name)");
$stmt->bindParam(':link', $file_url);
$stmt->bindParam(':alt', $desc_txt);
$stmt->bindParam(':file_name', $file_name);
$stmt->execute();
echo "File uploaded and record saved successfully.";
} catch (PDOException $e) {
echo "Database Error: " . $e->getMessage();
}
} else {
echo "Error: Could not move the uploaded file.";
}
} else {
echo "Error: Uploaded file is missing.";
}
} else {
switch ($_FILES['file']['error']) {
case UPLOAD_ERR_NO_FILE:
echo "No file was uploaded.";
break;
default:
echo "Unknown error occurred during file upload.";
break;
}
}
}
?>
<form method="post" enctype="multipart/form-data">
<div class="upload-container">
<p class="title">Files List & Add New Files</p>
<div class="file-upload-section">
<div class="upload-icon">
<label for="file" class="file-label">
<img src="/assets/upload.svg" alt="Upload" />
<input type="file" name="file" id="file" hidden />
</label>
</div>
<div class="input-section">
<div class="file-details">
<div id="file-name-show-section" class="file-name-section">
<span id="fileName">No file selected</span>
<button type="button" onclick="removeFile()" class="remove-file-btn">&times;</button>
</div>
<label for="desc_txt" class="input-label">ALT Text:</label>
<input type="text" name="desc_txt" id="desc_txt" class="text-input" placeholder="Description (6 words max)" />
</div>
<input type="submit" name="upload_file" id="upload_file" value="Upload" class="submit-btn" />
</div>
</div>
</div>
</form>
<div class="table-container">
<table class="responsive-table">
<thead>
<tr>
<th>ID</th>
<th>File Link</th>
<th>Action</th>
</tr>
</thead>
<tbody>
<?php
$conn = new PDO("mysql:host=$mariaServer;dbname=$mariaDb", $mariaUser, $mariaPass);
$conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
$stmt = $conn->prepare("SELECT * FROM `scc_files` ORDER BY id DESC ");
$stmt->execute();
$content = $stmt->fetchAll(PDO::FETCH_ASSOC);
foreach($content as $pageData){ ?>
<tr>
<td><?php echo $pageData['id']; ?></td>
<td><?php echo $pageData['link']; ?></td>
<td>
<div class="action-container">
<button onclick="copyToClipboard('<?php echo $pageData['link']; ?>', this)" class="action-btn">Copy</button>
<span class="copied-msg">Copied!</span>
<a href="<?php echo $home_uri_for_file_link . $pageData['link']; ?>" target="_blank" class="action-btn">View</a>
</div>
</td>
</tr>
<?php } ?>
</tbody>
</table>
</div>
<script>
// Copy to Clipboard
function copyToClipboard(text, button) {
var input = document.createElement('textarea');
input.value = text;
document.body.appendChild(input);
input.select();
document.execCommand('copy');
document.body.removeChild(input);
// Show 'Copied!' message and hide the button temporarily
var actionContainer = button.parentNode;
var copiedMsg = actionContainer.querySelector('.copied-msg');
copiedMsg.style.display = 'inline';
button.style.display = 'none';
// Hide the 'Copied!' message after 1 second
setTimeout(function () {
copiedMsg.style.display = 'none';
button.style.display = 'inline';
}, 1000);
}
// Show File Selection
document.getElementById('file').addEventListener('change', function (event) {
const file = event.target.files[0];
const fileNameSection = document.getElementById('file-name-show-section');
const fileNameSpan = document.getElementById('fileName');
if (file) {
fileNameSection.style.display = 'flex';
fileNameSpan.textContent = 'File Selected: ' + file.name;
} else {
fileNameSection.style.display = 'none';
fileNameSpan.textContent = 'No file selected';
}
});
// Remove File
function removeFile() {
const fileInput = document.getElementById('file');
const fileNameSection = document.getElementById('file-name-show-section');
const fileNameSpan = document.getElementById('fileName');
fileInput.value = '';
fileNameSection.style.display = 'none';
fileNameSpan.textContent = 'No file selected';
}
</script>
<style>
/* General Styles */
body {
font-family: Arial, sans-serif;
margin: 0;
padding: 0;
box-sizing: border-box;
}
.upload-container, .table-container {
margin: 20px auto;
width: 90%;
max-width: 800px;
}
.title {
font-size: 24px;
text-align: center;
margin-bottom: 20px;
color: #402517;
}
/* Upload Section */
.file-upload-section {
display: flex;
flex-wrap: wrap;
/* gap: 20px; */
border: 2px dashed #402517;
padding: 20px;
border-radius: 10px;
justify-content: center;
align-items: center;
box-shadow: 0px 4px 6px rgba(0, 0, 0, 0.1);
}
.upload-icon {
text-align: center;
}
.file-label {
background: #402517;
padding: 20px;
border-radius: 50%;
display: inline-block;
cursor: pointer;
transition: transform 0.3s ease;
}
.input-section {
display: flex;
flex-direction: column;
gap: 15px;
width: 100%;
}
.text-input {
border: 2px solid #7a7a7a;
padding: 7px;
border-radius: 5px;
width: 100%;
}
.submit-btn {
background-color: #402517;
color: #fff;
padding: 7px;
border: none;
border-radius: 5px;
cursor: pointer;
transition: background-color 0.3s ease;
outline: none;
}
.file-name-section {
display: none; /* Initially hidden */
gap: 10px;
align-items: center;
}
.remove-file-btn {
background-color: #402517;
color: #fff;
cursor: pointer;
border: none;
outline: none;
border-radius: 50%;
padding: 0 7px;
}
.remove-file-btn:hover {
background-color: #5c3d27;
}
.copied-msg {
display: none; /* Initially hidden */
background-color: #402517;
color: #fff;
border-radius: 6px;
padding: 6px 12px;
margin-left: 10px;
}
/* Table Section */
.table-container {
overflow-x: auto;
/* margin-top: 20px; */
}
.responsive-table {
width: 100%;
border-collapse: collapse;
margin: 0 auto;
box-shadow: 0px 4px 6px rgba(0, 0, 0, 0.1);
}
.responsive-table th, .responsive-table td {
border: 2px solid #7a7a7a;
padding: 10px;
text-align: center;
}
.responsive-table th {
background-color: #402517;
color: #fff;
}
.action-container {
display: flex;
gap: 10px;
justify-content: center;
}
.action-btn {
background-color: #402517;
color: #fff;
padding: 8px 12px;
border-radius: 5px;
text-decoration: none;
transition: background-color 0.3s ease;
outline: none;
border: none;
}
/* Responsive Design */
@media (max-width: 600px) {
.file-upload-section {
flex-direction: column;
}
.responsive-table {
font-size: 14px;
}
.action-btn {
font-size: 12px;
padding: 6px 8px;
}
}
</style>
<?php
require('../.hta_footer.php');
?>

82
admin/page-list.php Normal file
View File

@ -0,0 +1,82 @@
<?php
require('../.hta_config/env.php');
require('../.hta_header.php');
require('../.hta_admin_header.php');
$current_date_time = date("Y-m-d H:i:s");
?>
<p style="font-size: 25px; text-align: center; margin-top: 10px;">Page Content List</p>
<div class="table-container">
<table class="responsive-table">
<thead>
<tr>
<th style="border: 2px solid #7a7a7a;">ID</th>
<th style="border: 2px solid #7a7a7a;">Type</th>
<th style="border: 2px solid #7a7a7a;">Title</th>
<th style="border: 2px solid #7a7a7a;">Action</th>
</tr>
</thead>
<tbody>
<?php
$conn = new PDO("mysql:host=$mariaServer;dbname=$mariaDb", $mariaUser, $mariaPass);
$conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
$stmt = $conn->prepare("SELECT * FROM `scc24` WHERE type != 'faculty' ORDER BY id DESC ");
$stmt->execute();
$content = $stmt->fetchAll(PDO::FETCH_ASSOC);
foreach($content as $pageData){ ?>
<tr>
<td style="border: 2px solid #7a7a7a;"><?php echo $pageData['id']; ?></td>
<td style="border: 2px solid #7a7a7a;"><?php echo $pageData['type']; ?></td>
<td style="border: 2px solid #7a7a7a;"><?php echo $pageData['title']; ?></td>
<td style="border: 2px solid #7a7a7a;">
<div style="display: flex; flex-direction: row; justify-content: center; color: blue;">
<a href="edit-content.php?id=<?php echo $pageData['id']; ?>">Edit</a> &nbsp;
<a target="_blank" href="<?php if($pageData['type'] === 'notice'){echo '/notice/'.$pageData['slug'].'.html';} elseif($pageData['type'] === 'page'){echo '/'.$pageData['slug'].'.html';}?>">View</a>
</div>
</td>
</tr>
<?php } ?>
</tbody>
</table>
</div>
<?php
require('../.hta_footer.php');
?>
<style>
.table-container {
margin: 20px auto;
width: 90%;
max-width: 900px;
}
.table-container {
overflow-x: auto;
/* margin-top: 20px; */
}
.responsive-table {
width: 100%;
border-collapse: collapse;
margin: 0 auto;
box-shadow: 0px 4px 6px rgba(0, 0, 0, 0.1);
}
.responsive-table th, .responsive-table td {
border: 2px solid #7a7a7a;
padding: 10px;
/* text-align: center; */
}
.responsive-table th {
background-color: #402517;
color: #fff;
}
@media (max-width: 600px) {
.responsive-table {
font-size: 14px;
}
.action-btn {
font-size: 12px;
padding: 6px 8px;
}
}
</style>

1
assets/pell.css Normal file
View File

@ -0,0 +1 @@
.pell{border:1px solid hsla(0,0%,4%,.1)}.pell,.pell-content{box-sizing:border-box}.pell-content{height:450px;outline:0;overflow-y:auto;padding:10px}.pell-actionbar{background-color:#fff;border-bottom:1px solid hsla(0,0%,4%,.1)}.pell-button{background-color:transparent;border:none;cursor:pointer;height:30px;outline:0;width:30px;vertical-align:bottom}.pell-button-selected{background-color:#f0f0f0}

1
assets/pell.js Normal file
View File

@ -0,0 +1 @@
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e(t.pell={})}(this,function(t){"use strict";var e=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},c="defaultParagraphSeparator",l="formatBlock",a=function(t,e,n){return t.addEventListener(e,n)},s=function(t,e){return t.appendChild(e)},d=function(t){return document.createElement(t)},n=function(t){return document.queryCommandState(t)},f=function(t){var e=1<arguments.length&&void 0!==arguments[1]?arguments[1]:null;return document.execCommand(t,!1,e)},p={bold:{icon:"<b>B</b>",title:"Bold",state:function(){return n("bold")},result:function(){return f("bold")}},italic:{icon:"<i>I</i>",title:"Italic",state:function(){return n("italic")},result:function(){return f("italic")}},underline:{icon:"<u>U</u>",title:"Underline",state:function(){return n("underline")},result:function(){return f("underline")}},strikethrough:{icon:"<strike>S</strike>",title:"Strike-through",state:function(){return n("strikeThrough")},result:function(){return f("strikeThrough")}},heading1:{icon:"<b>H<sub>1</sub></b>",title:"Heading 1",result:function(){return f(l,"<h1>")}},heading2:{icon:"<b>H<sub>2</sub></b>",title:"Heading 2",result:function(){return f(l,"<h2>")}},paragraph:{icon:"&#182;",title:"Paragraph",result:function(){return f(l,"<p>")}},quote:{icon:"&#8220; &#8221;",title:"Quote",result:function(){return f(l,"<blockquote>")}},olist:{icon:"&#35;",title:"Ordered List",result:function(){return f("insertOrderedList")}},ulist:{icon:"&#8226;",title:"Unordered List",result:function(){return f("insertUnorderedList")}},code:{icon:"&lt;/&gt;",title:"Code",result:function(){return f(l,"<pre>")}},line:{icon:"&#8213;",title:"Horizontal Line",result:function(){return f("insertHorizontalRule")}},link:{icon:"&#128279;",title:"Link",result:function(){var t=window.prompt("Enter the link URL");t&&f("createLink",t)}},image:{icon:"&#128247;",title:"Image",result:function(){var t=window.prompt("Enter the image URL");t&&f("insertImage",t)}}},m={actionbar:"pell-actionbar",button:"pell-button",content:"pell-content",selected:"pell-button-selected"},r=function(n){var t=n.actions?n.actions.map(function(t){return"string"==typeof t?p[t]:p[t.name]?e({},p[t.name],t):t}):Object.keys(p).map(function(t){return p[t]}),r=e({},m,n.classes),i=n[c]||"div",o=d("div");o.className=r.actionbar,s(n.element,o);var u=n.element.content=d("div");return u.contentEditable=!0,u.className=r.content,u.oninput=function(t){var e=t.target.firstChild;e&&3===e.nodeType?f(l,"<"+i+">"):"<br>"===u.innerHTML&&(u.innerHTML=""),n.onChange(u.innerHTML)},u.onkeydown=function(t){var e;"Enter"===t.key&&"blockquote"===(e=l,document.queryCommandValue(e))&&setTimeout(function(){return f(l,"<"+i+">")},0)},s(n.element,u),t.forEach(function(t){var e=d("button");if(e.className=r.button,e.innerHTML=t.icon,e.title=t.title,e.setAttribute("type","button"),e.onclick=function(){return t.result()&&u.focus()},t.state){var n=function(){return e.classList[t.state()?"add":"remove"](r.selected)};a(u,"keyup",n),a(u,"mouseup",n),a(e,"click",n)}s(o,e)}),n.styleWithCSS&&f("styleWithCSS"),f(c,i),n.element},i={exec:f,init:r};t.exec=f,t.init=r,t.default=i,Object.defineProperty(t,"__esModule",{value:!0})});

1
assets/upload.svg Normal file
View File

@ -0,0 +1 @@
<svg width="90px" height="90px" viewBox="-2 0 32 32" xmlns="http://www.w3.org/2000/svg" fill="#FFFFFF"><g id="SVGRepo_bgCarrier" stroke-width="0"></g><g id="SVGRepo_tracerCarrier" stroke-linecap="round" stroke-linejoin="round"></g><g id="SVGRepo_iconCarrier"> <g id="Lager_3" data-name="Lager 3" transform="translate(-2 0)"> <g id="Group_2" data-name="Group 2"> <path id="Path_4" data-name="Path 4" d="M28,14H23.98A1.979,1.979,0,0,0,22,15.98v.04A1.979,1.979,0,0,0,23.98,18H25a1,1,0,0,1,1,1v8a1,1,0,0,1-1,1H7a1,1,0,0,1-1-1V19a1,1,0,0,1,1-1H8.02A1.979,1.979,0,0,0,10,16.02v-.04A1.979,1.979,0,0,0,8.02,14H4a2,2,0,0,0-2,2V30a2,2,0,0,0,2,2H28a2,2,0,0,0,2-2V16A2,2,0,0,0,28,14Z" fill="#FFFFF" fill-rule="evenodd"></path> <path id="Path_5" data-name="Path 5" d="M11.413,9.387,14,6.754V23a1,1,0,0,0,1,1h2a1,1,0,0,0,1-1V7.057l.26.042L20.587,9.4a2.017,2.017,0,0,0,2.833,0,1.969,1.969,0,0,0,0-2.807L17.346.581a2.017,2.017,0,0,0-2.833,0l-5.934,6a1.97,1.97,0,0,0,0,2.806A2.016,2.016,0,0,0,11.413,9.387Z" fill="#FFFFF" fill-rule="evenodd"></path> </g> </g> </g></svg>

After

Width:  |  Height:  |  Size: 1.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 156 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 640 KiB