Skip to content

Commit

Permalink
v23.11.1
Browse files Browse the repository at this point in the history
  • Loading branch information
seguinleo committed Nov 1, 2023
1 parent af4f945 commit 35b029c
Show file tree
Hide file tree
Showing 27 changed files with 1,061 additions and 1,513 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
#----v23.11.1----#
-Better Markdown (add table and strikethrough)
-Better PWA
-Improve UI/UX
-Bug fixes

#----v23.10.2----#
-Local notes are now also encrypted
-Better key management
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,9 @@ When I was looking for a note-taking application, I faced several difficulties:
## Features
All notes are encrypted with ``AES-256-GCM``.

The user can save and edit notes, change color, copy, export and use [Markdown](https://github.com/seguinleo/Bloc-notes/wiki/Markdown).
The user can save and edit notes, change color, copy, export and use Markdown. The user can create tasks lists, tables, links, code blocks, etc. The user can also search for notes by title. Read my [Markdown guide](https://github.com/seguinleo/Bloc-notes/wiki/Markdown).

The user can also sign in to sync all notes between their devices or browsers in a database. The user can also make a note public and share it via a random URL. No email is required, only a username and a strong password.
The user can also sign in to sync all notes between their devices or browsers in a secure database. The user can also make a note public and share it via a random URL. No email is required, only a username and a strong password.

This website is a PWA (Progressive Web App), the user can install it as an application. Service Worker has automatic updates.

Expand Down
14 changes: 14 additions & 0 deletions src/app.webmanifest
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,25 @@
"name": "Bloc-notes \u2013 Léo SEGUIN",
"short_name": "Bloc-notes",
"start_url": "./",
"id": "./",
"display": "standalone",
"background_color": "#171717",
"theme_color": "#171717",
"orientation": "portrait-primary",
"lang": "fr",
"scope": "./",
"screenshots": [
{
"src": "./assets/img/desktop.png",
"type": "image/png",
"sizes": "1728x1103"
},
{
"src": "./assets/img/mobile.png",
"type": "image/png",
"sizes": "531x1026"
}
],
"description": "Enregistrez des notes sur votre appareil ou connectez-vous pour synchroniser et chiffrer vos notes.",
"icons": [
{
Expand Down
2 changes: 1 addition & 1 deletion src/assets/css/style.css

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion src/assets/css/style.css.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Binary file added src/assets/fonts/OpenSans-700.woff2
Binary file not shown.
Binary file added src/assets/fonts/OpenSans.woff2
Binary file not shown.
Binary file added src/assets/img/desktop.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/assets/img/mobile.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
67 changes: 48 additions & 19 deletions src/assets/js/script.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,18 +37,12 @@ const showError = (message) => {
}, 5000);
};

const taskListEnablerExtension = () => [{
type: 'output',
regex: /<input type="checkbox"?/g,
replace: '<input type="checkbox"',
}];

const searchSideBar = () => {
document.querySelectorAll('.listNotes p').forEach((element) => {
sideBar.querySelectorAll('p').forEach((element) => {
element.addEventListener('click', () => {
const e = element.querySelector('.titleList').textContent;
document.querySelectorAll('.note').forEach((note) => {
const t = note.querySelector('.note h2').textContent;
const t = note.querySelector('.title').textContent;
if (t === e) {
note.scrollIntoView();
note.focus();
Expand All @@ -62,11 +56,12 @@ const searchSideBar = () => {
};

// eslint-disable-next-line no-undef
const converter = new showdown.Converter({
tasklists: true,
smoothLivePreview: true,
extensions: [taskListEnablerExtension],
});
const converter = new showdown.Converter();
converter.setOption('tables', true);
converter.setOption('tasklists', true);
converter.setOption('strikethrough', true);
converter.setOption('parseImgDimensions', true);
converter.setOption('simpleLineBreaks', true);

function arrayBufferToBase64(buffer) {
const binary = [];
Expand Down Expand Up @@ -153,7 +148,6 @@ const showNotes = async () => {
const objectStoreName = 'key';
const db = await openIndexedDB(dbName, objectStoreName);
const key = await getKeyFromDB(db, objectStoreName);
db.close();

notesJSON
.sort((a, b) => new Date(b.date) - new Date(a.date))
Expand Down Expand Up @@ -211,11 +205,13 @@ const showNotes = async () => {
editIconElement.setAttribute('data-note-color', couleur);
editIconElement.setAttribute('data-note-hidden', hidden);
editIconElement.setAttribute('role', 'button');
editIconElement.setAttribute('aria-label', 'Modifier la note');
const trashIconElement = document.createElement('i');
trashIconElement.classList.add('fa-solid', 'fa-trash-can', 'note-action');
trashIconElement.tabIndex = 0;
trashIconElement.setAttribute('data-note-id', id);
trashIconElement.setAttribute('role', 'button');
trashIconElement.setAttribute('aria-label', 'Supprimer la note');
bottomContentElement.appendChild(editIconElement);
bottomContentElement.appendChild(trashIconElement);

Expand All @@ -225,6 +221,7 @@ const showNotes = async () => {
clipboardIconElement.tabIndex = 0;
clipboardIconElement.setAttribute('data-note-desc', descEnd);
clipboardIconElement.setAttribute('role', 'button');
clipboardIconElement.setAttribute('aria-label', 'Copier la note');
bottomContentElement.appendChild(clipboardIconElement);

const downloadIconElement = document.createElement('i');
Expand All @@ -234,13 +231,15 @@ const showNotes = async () => {
downloadIconElement.setAttribute('data-note-title', deTitleString);
downloadIconElement.setAttribute('data-note-desc', descEnd);
downloadIconElement.setAttribute('role', 'button');
downloadIconElement.setAttribute('aria-label', 'Télécharger la note');
bottomContentElement.appendChild(downloadIconElement);

const expandIconElement = document.createElement('i');
expandIconElement.classList.add('fa-solid', 'fa-expand', 'note-action');
expandIconElement.tabIndex = 0;
expandIconElement.setAttribute('data-note-id', id);
expandIconElement.setAttribute('role', 'button');
expandIconElement.setAttribute('aria-label', 'Agrandir la note');
bottomContentElement.appendChild(expandIconElement);
}

Expand All @@ -258,10 +257,10 @@ const showNotes = async () => {
dateSpan.textContent = date;
paragraph.appendChild(titleSpan);
paragraph.appendChild(dateSpan);
document.querySelector('.sideBar .listNotes').appendChild(paragraph);
sideBar.querySelector('.listNotes').appendChild(paragraph);
searchSideBar();
});
document.querySelector('.sideBar h2').textContent = `Notes (${notesJSON.length})`;
searchSideBar();
sideBar.querySelector('h2').textContent = `Notes (${notesJSON.length})`;
};

const toggleFullscreen = (id) => {
Expand Down Expand Up @@ -289,6 +288,7 @@ const updateNote = (id, title, desc, couleur, hidden) => {
}
});
if (hidden === 'true') { document.querySelector('#checkHidden').checked = true; }
document.querySelector('#textareaLength').textContent = `${contentNote.value.length}/5000`;
contentNote.focus();
};

Expand Down Expand Up @@ -372,6 +372,7 @@ document.querySelectorAll('.seconnecter').forEach((element) => {
connectBox.classList.add('show');
document.body.classList.add('noscroll');
document.querySelector('#nomConnect').focus();
document.querySelector('#mdpConnect').disabled = true;
});
element.addEventListener('keydown', (event) => {
if (event.key === 'Enter') element.click();
Expand All @@ -391,6 +392,8 @@ document.querySelectorAll('.creercompte').forEach((element) => {
connectBox.classList.remove('show');
creerBox.classList.add('show');
document.querySelector('#nomCreer').focus();
document.querySelector('#mdpCreer').disabled = true;
document.querySelector('#mdpCreerValid').disabled = true;
});
element.addEventListener('keydown', (event) => {
if (event.key === 'Enter') element.click();
Expand Down Expand Up @@ -482,17 +485,43 @@ document.querySelector('#submitSeConnecter').addEventListener('click', async ()
}
});

document.querySelector('#nomConnect').addEventListener('input', () => {
const e = document.querySelector('#nomConnect').value.trim();
if (e.length >= 4 && e.length <= 25 && /^[a-zA-ZÀ-ÿ -]+$/.test(e)) {
document.querySelector('#mdpConnect').disabled = false;
} else {
document.querySelector('#mdpConnect').disabled = true;
}
});

document.querySelector('#nomCreer').addEventListener('input', () => {
const e = document.querySelector('#nomCreer').value.trim();
if (e.length >= 4 && e.length <= 25 && /^[a-zA-ZÀ-ÿ -]+$/.test(e)) {
document.querySelector('#mdpCreer').disabled = false;
document.querySelector('#mdpCreerValid').disabled = false;
} else {
document.querySelector('#mdpCreer').disabled = true;
document.querySelector('#mdpCreerValid').disabled = true;
}
});

document.querySelectorAll('.icon, .iconFloat').forEach((element) => {
element.addEventListener('click', () => {
noteBox.classList.add('show');
document.body.classList.add('noscroll');
document.querySelector('#title').focus();
document.querySelector('#textareaLength').textContent = '0/5000';
});
element.addEventListener('keydown', (event) => {
if (event.key === 'Enter') element.click();
});
});

contentNote.addEventListener('input', () => {
const e = contentNote.value.length;
document.querySelector('#textareaLength').textContent = `${e}/5000`;
});

couleurs.forEach((span, index) => {
span.addEventListener('click', (event) => {
couleurs.forEach((s) => {
Expand All @@ -510,7 +539,7 @@ document.querySelector('#submitNote').addEventListener('click', async () => {
const couleurSpan = document.querySelector('.couleurs span.selectionne');
const couleur = couleurSpan.classList[0];
const title = titleNote.value.trim();
const content = contentNote.value.trim().replaceAll(/</g, '&lt;').replaceAll(/>/g, '&gt;');
const content = contentNote.value.trim();
const hidden = document.querySelector('#checkHidden').checked;

if (!title || title.length > 30 || content.length > 5000) return;
Expand Down Expand Up @@ -626,7 +655,7 @@ document.querySelectorAll('header i').forEach((element) => {
});
});

document.querySelector('#search-input').addEventListener('keyup', () => {
document.querySelector('#search-input').addEventListener('input', () => {
const e = document.querySelector('#search-input').value.trim().toLowerCase();
document.querySelectorAll('.note').forEach((element) => {
const note = element;
Expand Down
Loading

0 comments on commit 35b029c

Please sign in to comment.