mirror of
https://github.com/ONLYOFFICE/document-server-integration.git
synced 2026-04-07 14:06:11 +08:00
ruby: get link to bookmark
This commit is contained in:
@ -8,7 +8,7 @@ class HomeController < ApplicationController
|
||||
|
||||
DocumentHelper.init(request.remote_ip, request.base_url)
|
||||
|
||||
@file = FileModel.new(:file_name => params[:fileName], :mode => params[:editorsMode], :type => params[:editorsType], :user_ip => request.remote_ip, :lang => cookies[:ulang], :uid => cookies[:uid], :uname => cookies[:uname])
|
||||
@file = FileModel.new(:file_name => params[:fileName], :mode => params[:editorsMode], :type => params[:editorsType], :user_ip => request.remote_ip, :lang => cookies[:ulang], :uid => cookies[:uid], :uname => cookies[:uname], :action_data => params[:actionLink])
|
||||
|
||||
end
|
||||
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
class FileModel
|
||||
|
||||
attr_accessor :file_name, :mode, :type, :user_ip, :lang, :uid, :uname
|
||||
attr_accessor :file_name, :mode, :type, :user_ip, :lang, :uid, :uname, :action_data
|
||||
|
||||
def initialize(attributes = {})
|
||||
@file_name = attributes[:file_name]
|
||||
@ -10,6 +10,7 @@ class FileModel
|
||||
@lang = attributes[:lang]
|
||||
@user_id = attributes[:uid]
|
||||
@user_name = attributes[:uname]
|
||||
@action_data = attributes[:action_data]
|
||||
end
|
||||
|
||||
def type
|
||||
@ -70,6 +71,7 @@ class FileModel
|
||||
}
|
||||
},
|
||||
:editorConfig => {
|
||||
:actionLink => @action_data ? JSON.parse(@action_data) : nil,
|
||||
:mode => mode,
|
||||
:lang => @lang ? @lang : "en",
|
||||
:callbackUrl => callback_url,
|
||||
|
||||
@ -38,6 +38,13 @@
|
||||
location.reload(true);
|
||||
};
|
||||
|
||||
var onMakeActionLink = function (event) {
|
||||
var actionData = event.data;
|
||||
var linkParam = JSON.stringify(actionData);
|
||||
var link = location.href + "&actionLink=" + encodeURIComponent(linkParam);
|
||||
docEditor.setActionLink(link);
|
||||
};
|
||||
|
||||
var сonnectEditor = function () {
|
||||
|
||||
var config = <%= raw @file.get_config.to_json %>;
|
||||
@ -48,7 +55,8 @@
|
||||
'onAppReady': onAppReady,
|
||||
'onDocumentStateChange': onDocumentStateChange,
|
||||
'onError': onError,
|
||||
'onOutdatedVersion': onOutdatedVersion
|
||||
'onOutdatedVersion': onOutdatedVersion,
|
||||
'onMakeActionLink': onMakeActionLink,
|
||||
};
|
||||
|
||||
<%
|
||||
|
||||
Reference in New Issue
Block a user