pptxgen实现拖拽可视化ppt演示文档生成设计导出pptx代码
代码语言:html
所属分类:其他
代码描述:pptxgen实现拖拽可视化ppt演示文档生成设计导出pptx代码,可编辑幻灯片,导出json还可预览演示文档。
代码标签: pptxgen 拖拽 可视化 ppt 演示 文档 生成 设计 导出 pptx 代码
下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开
<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>PPT多页编辑器 - 支持PPTX导出</title>
<script type="text/javascript" src="//repo.bfw.wiki/bfwrepo/js/pptxgen.bundle.js"></script>
<style>
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
body {
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
overflow: hidden;
height: 100vh;
background: #f5f5f5;
}
/* 主布局 */
.editor-container {
display: flex;
flex-direction: column;
height: 100vh;
}
/* 顶部工具栏 */
.toolbar {
background: #2c3e50;
color: white;
padding: 12px 20px;
display: flex;
align-items: center;
gap: 15px;
box-shadow: 0 2px 8px rgba(0,0,0,0.15);
z-index: 100;
flex-wrap: wrap;
}
.toolbar-title {
font-size: 18px;
font-weight: 600;
margin-right: auto;
}
.toolbar-btn {
background: #3498db;
color: white;
border: none;
padding: 8px 16px;
border-radius: 4px;
cursor: pointer;
font-size: 14px;
transition: all 0.3s;
display: flex;
align-items: center;
gap: 5px;
}
.toolbar-btn:hover {
background: #2980b9;
transform: translateY(-1px);
}
.toolbar-btn.danger {
background: #e74c3c;
}
.toolbar-btn.danger:hover {
background: #c0392b;
}
.toolbar-btn.success {
background: #27ae60;
}
.toolbar-btn.success:hover {
background: #229954;
}
.toolbar-btn.warning {
background: #f39c12;
}
.toolbar-btn.warning:hover {
background: #e67e22;
}
/* 主工作区 */
.workspace {
display: flex;
flex: 1;
overflow: hidden;
}
/* 左侧缩略图面板 */
.sidebar {
width: 220px;
background: #34495e;
display: flex;
flex-direction: column;
box-shadow: 2px 0 8px rgba(0,0,0,0.1);
}
.sidebar-header {
padding: 15px;
background: #2c3e50;
color: white;
font-weight: 600;
border-bottom: 1px solid #1a252f;
}
.slides-list {
flex: 1;
overflow-y: auto;
padding: 10px;
}
.slide-thumbnail {
background: white;
border-radius: 6px;
margin-bottom: 12px;
cursor: pointer;
transition: all 0.3s;
border: 3px solid transparent;
position: relative;
}
.slide-thumbnail:hover {
transform: translateX(5px);
box-shadow: 0 4px 12px rgba(0,0,0,0.2);
}
.slide-thumbnail.active {
border-color: #3498db;
box-shadow: 0 4px 16px rgba(52, 152, 219, 0.4);
}
.slide-thumbnail-content {
aspect-ratio: 16/9;
padding: 8px;
font-size: 10px;
overflow: hidden;
position: relative;
background: white;
border-radius: 4px;
}
.slide-number {
position: absolute;
top: 5px;
left: 5px;
background: rgba(0,0,0,0.6);
color: white;
padding: 2px 6px;
border-radius: 3px;
font-size: 11px;
font-weight: 600;
}
.slide-actions {
display: flex;
gap: 5px;
padding: 8px;
background: #ecf0f1;
border-radius: 0 0 6px 6px;
}
.slide-action-btn {
flex: 1;
border: none;
background: #95a5a6;
color: white;
padding: 5px;
border-radius: 3px;
cursor: pointer;
font-size: 11px;
transition: all 0.2s;
}
.slide-action-btn:hover {
background: #7f8c8d;
}
.add-slide-btn {
width: 100%;
padding: 12px;
background: #27ae60;
color: white;
border: none;
border-radius: 6px;
cursor: pointer;
font-size: 14px;
font-weight: 600;
margin: 10px;
width: calc(100% - 20px);
transition: all 0.3s;
}
.add-slide-btn:hover {
background: #229954;
transform: translateY(-2px);
}
/* 中间编辑区 */
.editor-main {
flex: 1;
display: flex;
flex-direction: column;
background: #ecf0f1;
overflow: hidden;
}
.editor-toolbar {
background: white;
padding: 12px 20px;
border-bottom: 1px solid #ddd;
display: flex;
gap: 10px;
flex-wrap: wrap;
box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}
.editor-btn-group {
display: flex;
gap: 5px;
align-items: center;
padding-right: 15px;
border-right: 1px solid #ddd;
}
.editor-btn-group:last-child {
border-right: none;
}
.editor-btn {
padding: 6px 12px;
border: 1px solid #ddd;
background: white;
cursor: pointer;
border-radius: 4px;
transition: all 0.2s;
font-size: 13px;
}
.editor-btn:hover {
background: #f8f9fa;
border-color: #3498db;
}
.editor-btn.active {
background: #3498db;
color: white;
border-color: #3498db;
}
.editor-canvas {
flex: 1;
display: flex;
align-items: center;
justify-content: center;
padding: 30px;
overflow: auto;
}
.slide-canvas {
background: white;
width: 960px;
height: 540px;
box-shadow: 0 8px 32px rgba(0,0,0,0.15);
position: relative;
border-radius: 8px;
overflow: hidden;
}
/* 编辑元素 */
.slide-element {
position: absolute;
border: 2px dashed transparent;
cursor: move;
transition: border-color 0.2s;
user-select: none;
}
.slide-element:hover {
border-color: #3498db;
}
.slide-element.selected {
border-color: #3498db;
border-style: solid;
}
.slide-element.editing {
cursor: text;
}
.slide-element .resize-handle {
position: absolute;
width: 10px;
height: 10px;
background: #3498db;
border: 2px solid white;
border-radius: 50%;
display: none;
z-index: 10;
}
.slide-element.selected .resize-handle {
display: block;
}
.resize-handle.nw { top: -5px; left: -5px; cursor: nw-resize; }
.resize-handle.ne { top: -5px; right: -5px; cursor: ne-resize; }
.resize-handle.sw { bottom: -5px; left: -5px; cursor: sw-resize; }
.resize-handle.se { bottom: -5px; right: -5px; cursor: se-resize; }
.text-element {
padding: 10px;
font-size: 16px;
line-height: 1.5;
min-width: 100px;
min-height: 40px;
overflow: hidden;
}
.text-element.editing {
outline: 2px solid #3498db;
cursor: text;
}
.text-content {
width: 100%;
height: 100%;
outline: none;
pointer-events: none;
}
.text-element.editing .text-content {
pointer-events: auto;
}
.image-element img {
width: 100%;
height: 100%;
object-fit: contain;
pointer-events: none;
}
.shape-element {
background: #3498db;
border-radius: 4px;
}
/* 右侧属性面板 */
.properties-panel {
width: 280px;
background: white;
border-left: 1px solid #ddd;
overflow-y: auto;
display: flex;
flex-direction: column;
}
.properties-header {
padding: 15px;
background: #34495e;
color: white;
font-weight: 600;
}
.properties-section {
padding: 15px;
border-bottom: 1px solid #ecf0f1;
}
.properties-section h3 {
font-size: 13px;
color: #7f8c8d;
margin-bottom: 12px;
text-transform: uppercase;
letter-spacing: 0.5px;
}
.property-row {
margin-bottom: 12px;
}
.property-row label {
display: block;
font-size: 13px;
margin-bottom: 5px;
color: #555;
font-weight: 500;
}
.property-row input,
.property-row select {
width: 100%;
padding: 8px;
border: 1px solid #ddd;
border-radius: 4px;
font-size: 13px;
}
.property-row input[type="color"] {
height: 36px;
cursor: pointer;
}
.property-row input[type="range"] {
cursor: pointer;
}
/* 预览模式 */
.preview-overlay {
position: fixed;
top: 0;
left: 0;
right: 0;
bottom: 0;
.........完整代码请登录后点击上方下载按钮下载查看
















网友评论0