Skip to content

Commit c3b6a5d

Browse files
setando valores padrão caso não tenha cookies
1 parent 82eb264 commit c3b6a5d

File tree

2 files changed

+7
-6
lines changed

2 files changed

+7
-6
lines changed

public/assets/js/script.js

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -27,23 +27,23 @@ $(document).ready(function(){
2727

2828
$('#text').val(Cookies.get("markdownText"));
2929

30-
let textColor = Cookies.get("textColor");
30+
let textColor = Cookies.get("textColor") ?? '#374151';
3131
$('#textColor').val(textColor);
3232
root.style.setProperty('--textColor', textColor);
3333

34-
let highlightColor = Cookies.get("highlightColor");
34+
let highlightColor = Cookies.get("highlightColor") ?? '#559949';
3535
$('#highlightColor').val(highlightColor);
3636
root.style.setProperty('--highlightColor', highlightColor);
3737

38-
let backgroundColor = Cookies.get("backgroundColor");
38+
let backgroundColor = Cookies.get("backgroundColor") ?? '#FFFFFF';
3939
$('#backgroundColor').val(backgroundColor);
4040
root.style.setProperty('--backgroundColor', backgroundColor);
4141

42-
let titleMargin = Cookies.get("titleMargin");
42+
let titleMargin = Cookies.get("titleMargin") ?? '4';
4343
$('#titleMargin').val(titleMargin);
4444
root.style.setProperty('--titleMargin', titleMargin+'px');
4545

46-
let marginHeight = Cookies.get("marginHeight");
46+
let marginHeight = Cookies.get("marginHeight") ?? '4';
4747
$('#marginHeight').val(marginHeight);
4848
root.style.setProperty('--marginHeight', marginHeight+'px');
4949

@@ -97,6 +97,7 @@ $(document).ready(function(){
9797
tempTextarea.remove();
9898
});
9999

100+
100101
let insertTextInTextarea = function(newText){
101102
event.preventDefault();
102103
let textarea = $('#text');

resources/views/layouts/app.blade.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
<title>{{ config('app.name', 'Markdown Editor') }}</title>
2020

2121
<link rel="icon" href="{{ url('assets/images/favicon.svg') }}">
22-
<link rel="stylesheet" href="{{ asset('assets/css/app.css?v2') }}" >
22+
<link rel="stylesheet" href="{{ asset('assets/css/app.css?v3') }}" >
2323

2424
<!-- Scripts -->
2525
@vite(['resources/css/app.css', 'resources/js/app.js'])

0 commit comments

Comments
 (0)