赞
踩
目前两个版本:编译版本200元,明文改造版另议。
form双向表单演示:onlyoffice双向绑定form表单数据_哔哩哔哩_bilibili
- (function (window, undefined) {
- (function (window) {
- var MAX_ACTION_TIME = 20;
- var TIMEOUT_TIME = 20;
- function CActionOnTimerBase() {
- this.TimerId = null;
- this.Start = false;
- this.FirstActionOnTimer = false;
- }
- CActionOnTimerBase.prototype.Begin = function () {
- if (this.Start) this.End();
- this.Start = true;
- this.OnBegin.apply(this, arguments);
- var oThis = this;
- if (this.FirstActionOnTimer)
- this.TimerId = setTimeout(function () {
- oThis.Continue();
- }, TIMEOUT_TIME);
- else this.Continue();
- };
- CActionOnTimerBase.prototype.Continue = function () {
- if (this.IsContinue()) {
- var nTime = performance.now();
- this.OnStartTimer();
- while (this.IsContinue()) {
- if (performance.now() - nTime > MAX_ACTION_TIME) break;
- this.DoAction();
- }
- this.OnEndTimer();
- }
- var oThis = this;
- if (this.IsContinue())
- this.TimerId = setTimeout(function () {
- oThis.Continue();
- }, TIMEOUT_TIME);
- else this.End();
- };
- CActionOnTimerBase.prototype.End = function () {
- this.Reset();
- if (this.Start) {
- this.Start = false;
- this.OnEnd();
- }
- };
- CActionOnTimerBase.prototype.Reset = function () {
- if (this.TimerId) clearTimeout(this.TimerId);
- this.TimerId = null;
- this.Index = -1;
- };
- CActionOnTimerBase.prototype.SetDoFirstActionOnTimer = function (
- isOnTimer
- ) {
- this.FirstActionOnTimer = isOnTimer;
- };
- CActionOnTimerBase.prototype.OnBegin = function () {};
- CActionOnTimerBase.prototype.OnEnd = function () {};
- CActionOnTimerBase.prototype.IsContinue = function () {
- return false;
- };
- CActionOnTimerBase.prototype.OnStartTimer = function () {};
- CActionOnTimerBase.prototype.DoAction = function () {};
- CActionOnTimerBase.prototype.OnEndTimer = function () {};
- window["AscCommon"] = window["AscCommon"] || {};
- window["AscCommon"].CActionOnTimerBase = CActionOnTimerBase;
- })(window);
- ("use strict");
- (function (window) {
- var g_oCanvas = null;
- var g_oTable = null;
- function GetCanvas() {
- if (g_oCanvas == null) {
- g_oCanvas = document.createElement("canvas");
- g_oCanvas.width =
- (TABLE_STYLE_WIDTH_PIX * AscCommon.AscBrowser.retinaPixelRatio) >> 0;
- g_oCanvas.height =
- (TABLE_STYLE_HEIGHT_PIX * AscCommon.AscBrowser.retinaPixelRatio) >> 0;
- }
- return g_oCanvas;
- }
- function GetTable(oLogicDocument) {
- if (g_oTable == null) g_oTable = oLogicDocument.GetTableForPreview();
- oLogicDocument.CheckTableForPreview(g_oTable);
- return g_oTable;
- }
- function CTableStylesPreviewGenerator(oLogicDocument) {
- AscCommon.CActionOnTimerBase.call(this);
- this.FirstActionOnTimer = true;
- this.Api = oLogicDocument.GetApi();
- this.LogicDocument = oLogicDocument;
- this.DrawingDocument = oLogicDocument.GetDrawingDocument();
- this.TableStyles = [];
- this.TableLook = null;
- this.Index = -1;
- this.Buffer = [];
- }
- CTableStylesPreviewGenerator.prototype = Object.create(
- AscCommon.CActionOnTimerBase.prototype
- );
- CTableStylesPreviewGenerator.prototype.constructor =
- CTableStylesPreviewGenerator;
- CTableStylesPreviewGenerator.prototype.OnBegin = function (
- isDefaultTableLook
- ) {
- this.TableStyles = this.LogicDocument.GetAllTableStyles();
- this.Index = -1;
- this.TableLook = this.DrawingDocument.GetTableLook(isDefaultTableLook);
- this.Api.sendEvent(
- "asc_onBeginTableStylesPreview",
- this.TableStyles.length
- );
- };
- CTableStylesPreviewGenerator.prototype.OnEnd = function () {
- this.Api.sendEvent("asc_onEndTableStylesPreview");
- };
- CTableStylesPreviewGenerator.prototype.IsContinue = function () {
- return this.Index < this.TableStyles.length;
- };
- CTableStylesPreviewGenerator.prototype.DoAction = function () {
- var oPreview = this.GetPreview(this.TableStyles[this.Index]);
- if (oPreview) this.Buffer.push(oPreview);
- this.Index++;
- };
- CTableStylesPreviewGenerator.prototype.OnEndTimer = function () {
- this.Api.sendEvent("asc_onAddTableStylesPreview", this.Buffer);
- this.Buffer = [];
- };
- CTableStylesPreviewGenerator.prototype.GetAllPreviews = function (
- isDefaultTableLook
- ) {
- var oTableLookOld = this.TableLook;
- this.TableLook = this.DrawingDocument.GetTableLook(isDefaultTableLook);
- var arrStyles = this.LogicDocument.GetAllTableStyles();
- var arrPreviews = [];
- for (
- var nIndex = 0, nCount = arrStyles.length;
- nIndex < nCount;
- ++nIndex
- ) {
- var oPreview = this.GetPreview(arrStyles[nIndex]);
- if (oPreview) arrPreviews.push(oPreview);
- }
- this.TableLook = oTableLookOld;
- return arrPreviews;
- };
- CTableStylesPreviewGenerator.prototype.GetAllPreviewsNative = function (
- isDefaultTableLook,
- oGraphics,
- oStream,
- oNative,
- dW,
- dH,
- nW,
- nH
- ) {
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。