Pen Settings

HTML

CSS

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URLs added here will be added as <link>s in order, and before the CSS in the editor. You can use the CSS from another Pen by using its URL and the proper URL extension.

+ add another resource

JavaScript

Babel includes JSX processing.

Add External Scripts/Pens

Any URL's added here will be added as <script>s in order, and run before the JavaScript in the editor. You can use the URL of any other Pen and it will include the JavaScript from that Pen.

+ add another resource

Packages

Add Packages

Search for and use JavaScript packages from npm here. By selecting a package, an import statement will be added to the top of the JavaScript editor for this package.

Behavior

Auto Save

If active, Pens will autosave every 30 seconds after being saved once.

Auto-Updating Preview

If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.

Format on Save

If enabled, your code will be formatted when you actively save your Pen. Note: your code becomes un-folded during formatting.

Editor Settings

Code Indentation

Want to change your Syntax Highlighting theme, Fonts and more?

Visit your global Editor Settings.

HTML

              
                <div>
  <button id="insert">insert</button>
  <button id="init">init</button>
  <button id="next">next</button>
  <button id="pre">pre</button>
</div>
<div id="whiteboard"> 
              
            
!

CSS

              
                #whiteboard {
  background-color: gray;
  width: 100%;
  height: 100vh;
}
              
            
!

JS

              
                //server 端 response
var json = {
    "code": 200,
    "msg": {
        "room": {
            "id": 255673,
            "name": "postman-room",
            "limit": 0,
            "teamId": 341,
            "adminId": 216,
            "mode": "historied",
            "template": "meeting",
            "region": "cn",
            "uuid": "62d831fff0db427599e69d2527f98f42",
            "updatedAt": "2019-11-09T10:16:35.030Z",
            "createdAt": "2019-11-09T10:16:34.937Z",
            "appIdentifier": "com.herewhite.whiteboard",
            "appHash": "004ab57536b28e23c4268721e74dfa16",
            "appVersion": "2.0.0",
            "akkoVersion": "1.4.2"
        },
        "hare": {
            "uuid": "62d831fff0db427599e69d2527f98f42",
            "appIdentifier": "com.herewhite.whiteboard",
            "appVersion": "2.0.0",
            "appHash": "004ab57536b28e23c4268721e74dfa16",
            "akkoVersion": "1.4.2",
            "teamId": "341",
            "mode": "historied",
            "region": "cn",
            "isBan": false,
            "createdAt": 1573294594995,
            "updatedAt": 1573294594999,
            "usersMaxCount": 0,
            "survivalDuration": 30000
        },
        "roomToken": "WHITEcGFydG5lcl9pZD1OZ3pwQWNBdlhiemJERW9NY0E0Z0V3RTUwbVZxM0NIbDJYV0Ymc2lnPTM3NGVlZWQ1MzkzMjk4YWQzY2FlOGMwZDEzY2IxZDc0NmE1NDJiOTk6YWRtaW5JZD0yMTYmcm9vbUlkPTYyZDgzMWZmZjBkYjQyNzU5OWU2OWQyNTI3Zjk4ZjQyJnRlYW1JZD0zNDEmcm9sZT1yb29tJmV4cGlyZV90aW1lPTE2MDQ4NTE1NDcmYWs9Tmd6cEFjQXZYYnpiREVvTWNBNGdFd0U1MG1WcTNDSGwyWFdGJmNyZWF0ZV90aW1lPTE1NzMyOTQ1OTUmbm9uY2U9MTU3MzI5NDU5NDk1MTAw",
        "code": 201
    }
}

let sdk = new WhiteWebSdk();
//将通过 sdkToken 创建的房间 uuid 以及 roomToken 填入。
sdk.joinRoom({
  //数据为创建房间 API 返回的响应内容格式。
  uuid: "62d831fff0db427599e69d2527f98f42",
  roomToken: "WHITEcGFydG5lcl9pZD1OZ3pwQWNBdlhiemJERW9NY0E0Z0V3RTUwbVZxM0NIbDJYV0Ymc2lnPTM3NGVlZWQ1MzkzMjk4YWQzY2FlOGMwZDEzY2IxZDc0NmE1NDJiOTk6YWRtaW5JZD0yMTYmcm9vbUlkPTYyZDgzMWZmZjBkYjQyNzU5OWU2OWQyNTI3Zjk4ZjQyJnRlYW1JZD0zNDEmcm9sZT1yb29tJmV4cGlyZV90aW1lPTE2MDQ4NTE1NDcmYWs9Tmd6cEFjQXZYYnpiREVvTWNBNGdFd0U1MG1WcTNDSGwyWFdGJmNyZWF0ZV90aW1lPTE1NzMyOTQ1OTUmbm9uY2U9MTU3MzI5NDU5NDk1MTAw",
disableDeviceInputs: true,
disableOperation: true,
isWritable: false
}, {
  onRoomStateChanged: s => {
    if (s.sceneState) {
      console.log(JSON.stringify(s));
    }
  },
}).then(function (room) {
  // 将 room 绑定在全局变量上。
  window.room = room;
  // 将 room 实例绑定到要渲染的 div 上。
  room.bindHtmlElement(document.getElementById("whiteboard"));
  //清空当前白板页面内容
  // room.cleanCurrentScene(false);
}).catch(function (err) {
  console.error(err);
});

function refreshViewSize() {
  //白板 div 发生宽高变化时,需要主动调用该方法。
  room && room.refreshViewSize();
};

//当 div 从 HTML DOM 中移除时,请调用 removeEventListener 移除监听。
window.addEventListener("resize", refreshViewSize);
document.getElementById("insert").addEventListener("click", e => {
    console.log("insert");
    // room.putScenes("/ppt", [{name: "1"}, {name: "2"}, {name: "3"}]);
  room.setScenePath("/ppt/1");
});
document.getElementById("init").addEventListener("click", e => {
    console.log("init");
    room.setScenePath("/init")
});

document.getElementById("next").addEventListener("click", e => {
    const i = room.state.sceneState.index || 0;
      console.log("next current: ", i);
  if (i < 2) {
    room.setSceneIndex(i+1)
  }
});

document.getElementById("pre").addEventListener("click", e => {

    const i = room.state.sceneState.index || 0;
      console.log("pre current: ", i);
  if (i > 0) {
    room.setSceneIndex(i-1)
  }
});
              
            
!
999px

Console