Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add erase current canvas #318

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions editor.html
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,15 @@
<button class="btn btn-light" title="Redo (Ctrl/Cmd + Shift + Z)" id="redo-btn" data-vvveb-action="redo" data-vvveb-shortcut="ctrl+shift+z">
<i class="la la-undo la-flip-horizontal"></i>
</button>

<button class="btn btn-light" title="Effacer le contenu" id="erase" type="button" data-bs-toggle="button" aria-pressed="false" data-vvveb-action="erase">
<svg xmlns="http://www.w3.org/2000/svg" class="icon icon-tabler icon-tabler-eraser" width="24" height="24" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round">
<path stroke="none" d="M0 0h24v24H0z" fill="none"></path>
<path d="M19 20h-10.5l-4.21 -4.3a1 1 0 0 1 0 -1.41l10 -10a1 1 0 0 1 1.41 0l5 5a1 1 0 0 1 0 1.41l-9.2 9.3"></path>
<path d="M18 13.3l-6.3 -6.3"></path>
</svg>
</button>

</div>


Expand Down
19 changes: 18 additions & 1 deletion libs/builder/builder.js
Original file line number Diff line number Diff line change
Expand Up @@ -690,7 +690,7 @@ Vvveb.WysiwygEditor = {
e.preventDefault();
return false;
});

let sizes = "<option value=''> - Font size - </option>";
for (i = 1;i <= 128; i++) {
sizes += "<option value='"+ i +"px'>"+ i +"</option>";
Expand Down Expand Up @@ -2188,6 +2188,23 @@ Vvveb.Gui = {
$("#iframe-layer").toggle();
$("#vvveb-builder").toggleClass("preview");
},

erase : function () {
if(confirm('Clean the current Canvas ?')){

// find all section and delete the current document sections
var sectionItems = document.querySelectorAll('.section-item');
sectionItems.forEach(function(sectionItem) {
var deleteButton = sectionItem.querySelector('.delete-btn');
if (deleteButton) {
deleteButton.click();
}
});

// reload all section after deleted canvas
Vvveb.SectionList.loadSections();
}
},

fullscreen : function () {
launchFullScreen(document); // the whole page
Expand Down