Skip to content

Commit 66350ea

Browse files
committed
add code block
1 parent fb6a7ed commit 66350ea

11 files changed

Lines changed: 90 additions & 40 deletions

File tree

dist/content.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/manifest.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
{
22
"manifest_version": 3,
33
"name": "I Notes",
4-
"version": "1.7.9",
4+
"version": "1.8.0",
55
"description": "i Notes is a lightweight, easy-to-use extension for taking quick notes, saving developer commands",
66
"permissions": [
77
"storage",
88
"notifications",
99
"alarms",
1010
"identity"
11-
1211
],
12+
"host_permissions": ["<all_urls>"],
1313
"action": {
1414
"default_popup": "popup.html"
1515
},

dist/popup.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/settings.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

public/background.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
// alarm
12
chrome.alarms.onAlarm.addListener((alarm) => {
23
console.log("Alarm triggered:", alarm.name);
34

@@ -18,10 +19,12 @@ chrome.alarms.onAlarm.addListener((alarm) => {
1819

1920
});
2021

22+
// welcome note
2123
chrome.runtime.onInstalled.addListener(() => {
2224
console.log("I Notes extension installed");
2325
});
2426

27+
// google auth
2528
chrome.runtime.onMessage.addListener((message, sender, sendResponse) => {
2629
if (message.action === "startGoogleLogin") {
2730
const clientId = process.env.GOOGLE_AUTH_CLIENT_ID;

public/manifest.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
{
22
"manifest_version": 3,
33
"name": "I Notes",
4-
"version": "1.7.9",
4+
"version": "1.8.0",
55
"description": "i Notes is a lightweight, easy-to-use extension for taking quick notes, saving developer commands",
66
"permissions": [
77
"storage",
88
"notifications",
99
"alarms",
1010
"identity"
11-
1211
],
12+
"host_permissions": ["<all_urls>"],
1313
"action": {
1414
"default_popup": "popup.html"
1515
},

src/components/RichText.jsx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,9 @@ const RichText = ({ editorRef, handleFormat }) => {
1919
<button onClick={() => handleFormat("insertOrderedList")} className="border-0 bg-transparent">
2020
<i className="fa-solid fa-list-ol"></i>
2121
</button>
22+
<button onClick={() => handleFormat("code")} className="border-0 bg-transparent">
23+
<i className="fas fa-code"></i>
24+
</button>
2225
</nav>
2326
<div
2427
ref={editorRef}

src/components/common_style.css

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -195,3 +195,22 @@ i.fa-thumbtack.pinned {
195195
#note-input{
196196
min-height: 5rem;
197197
}
198+
199+
.highlight-code {
200+
background-color: #bdbdbd;
201+
color: #f8f8f2;
202+
font-family: monospace;
203+
padding: 2px 4px;
204+
border-radius: 4px;
205+
background-color: #f8f8f8;
206+
padding: 3px;
207+
margin: 8px 0;
208+
white-space: pre-wrap;
209+
font-family: 'Courier New', Courier, monospace;
210+
border-radius: 3px;
211+
color: black;
212+
}
213+
.dark-mode .highlight-code {
214+
background-color: #474747;
215+
color: white;
216+
}

src/content.js

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ chrome.storage.local.get(["settings"], (result) => {
6666
cursor: 'pointer',
6767
boxShadow: '0 0 2px rgba(0,0,0,0.3)',
6868
fontWeight: 'bold',
69-
display: 'none' // Initially hidden
69+
display: 'none'
7070
}, {
7171
innerText: '×',
7272
title: 'Hide'
@@ -79,7 +79,6 @@ chrome.storage.local.get(["settings"], (result) => {
7979
e.stopPropagation();
8080
openBtn.style.display = 'none';
8181

82-
// Update chrome.storage.local settings
8382
chrome.storage.local.get(["settings"], (result) => {
8483
const settings = result.settings || {};
8584
settings.hideSortNotes = true;
@@ -187,7 +186,7 @@ chrome.storage.local.get(["settings"], (result) => {
187186
const html = `
188187
<div class="note-item" style="padding: 10px 0px; border-bottom: 1px solid #6c757d;">
189188
<div>
190-
<div class="note-text">${note.text}</div>
189+
<div class="note-text">${note.text.replace(/`([^`]+)`/g, `<code style="background-color:#c2c2c2;color:black;font-family:'Courier New',Courier,monospace;padding:3px;margin:8px 0;white-space:pre-wrap;border-radius:3px;">$1</code>`) }</div>
191190
<span class="options" style="display: flex; justify-content: space-between; align-items: center;" data-id="${note.id}">
192191
<small class="date" style="font-size: 0.5rem; color: #6c757d; border: 1px solid #6c757d; border-radius: 12px; padding: 1px 8px;">${formatDate(note.date)}</small>
193192
<div class="icons">

0 commit comments

Comments
 (0)