Application method and device of resources in online document, electronic equipment and storage medium
By receiving resource requests in online documents and downloading them to a local path, the resource unavailability problem of online documents in offline or poor network conditions is solved, the offline application and stability of resources is achieved, and the user experience is improved.
Patent Information
- Application Number
- CN202411548391.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-10-31
- Publication Date
- 2025-01-10
AI Technical Summary
In scenarios where the network is poor or offline, when using online documents, the resources in the documents cannot be used normally, affecting the user experience.
By receiving resource requests sent by the web page, call the resource manager to download resources in the online document to the local path, and render and display them offline, establish a mapping relationship between the resource token and the local path, and ensure that the resources are offline or online Accessibility in poor situations.
It realizes offline application of online document resources, improves user experience, and avoids resource loss caused by browser cache clearance and expiration, ensuring that resources are continuously available offline.
Smart Images

Figure CN119293359A_ABST
Abstract
Description
Technical Field
[0001] The embodiments of the present disclosure relate to the field of computer technology, and in particular, to a method, device, electronic device, and storage medium for applying resources in an online document. Background Art
[0002] Currently, when using online documents in scenarios with poor network conditions or even offline, the resources in the documents cannot be used normally, affecting the user experience. Summary of the invention
[0003] The embodiments of the present disclosure provide a method, device, electronic device and storage medium for applying resources in an online document, which can realize offline application of resources in an online document and improve user experience.
[0004] In a first aspect, an embodiment of the present disclosure provides a method for applying resources in an online document, including:
[0005] Receiving a resource request for an online document sent by a web page; wherein the web page sends the resource request in response to an access instruction to the online document in an offline state; the resource request is used to obtain a first resource recorded in the online document;
[0006] Invoke a resource manager according to the resource request, so that the resource manager returns a first local path; wherein the first resource is downloaded to the first local path through the resource manager when the online document is online;
[0007] The first resource is acquired according to the first local path, and the first resource is returned to the web page, so that the web page renders and displays the first resource in the online document.
[0008] In a second aspect, an embodiment of the present disclosure provides a method for applying resources in an online document, including:
[0009] Receiving a path request for a second resource to be added sent by a web page; wherein the web page sends the path request in response to a resource adding instruction for an online document in an offline state; and the path request includes a first identifier of the second resource;
[0010] Determine a second local path of the second resource according to the first identifier in the path request;
[0011] Returning the second local path to the web page end, so that the web page end calls the resource manager according to the second local path, so that the resource manager copies the second resource to a preset storage path, generates a second identifier of the second resource, and constructs a second mapping relationship between the second identifier and the preset storage path;
[0012] Receive the second identifier sent by the web page, and construct a third mapping relationship between the first identifier and the second identifier; wherein the second mapping relationship and the third mapping relationship are used for uploading the second resource when the online document is online.
[0013] In a third aspect, the embodiment of the present disclosure further provides an application device for resources in an online document, including:
[0014] A first receiving module, configured to receive a resource request for an online document sent by a web page; wherein the web page sends the resource request in response to an access instruction to the online document in an offline state; and the resource request is used to obtain a first resource recorded in the online document;
[0015] A first path determination module is used to call a resource manager according to the resource request, so that the resource manager returns a first local path; wherein the first resource is downloaded to the first local path through the resource manager when the online document is online;
[0016] A rendering and display module is used to obtain the first resource according to the first local path, and return the first resource to the web page, so that the web page renders and displays the first resource in the online document.
[0017] In a fourth aspect, the embodiment of the present disclosure further provides an application device for resources in an online document, including:
[0018] A second receiving module is used to receive a path request for a second resource to be added sent by a web page; wherein the web page sends the path request in response to a resource adding instruction for an online document in an offline state; and the path request includes a first identifier of the second resource;
[0019] A second path determination module, configured to determine a second local path of the second resource according to the first identifier in the path request;
[0020] A resource persistence module, used to return the second local path to the web page end, so that the web page end calls the resource manager according to the second local path, so that the resource manager copies the second resource to a preset storage path, generates a second identifier of the second resource, and constructs a second mapping relationship between the second identifier and the preset storage path;
[0021] The second receiving module is also used to receive the second identifier sent by the web page and construct a third mapping relationship between the first identifier and the second identifier; wherein the second mapping relationship and the third mapping relationship are used for uploading the second resource when the online document is online.
[0022] In a fifth aspect, an embodiment of the present disclosure further provides an electronic device, the electronic device comprising:
[0023] one or more processors;
[0024] a storage device for storing one or more programs,
[0025] When the one or more programs are executed by the one or more processors, the one or more processors implement the method for applying resources in an online document as described in any one of the embodiments of the present disclosure.
[0026] In a sixth aspect, an embodiment of the present disclosure further provides a storage medium comprising computer executable instructions, which, when executed by a computer processor, are used to execute a method for applying resources in an online document as described in any one of the embodiments of the present disclosure.
[0027] In the technical solution of the embodiment of the present disclosure, a resource request for an online document sent by a web page can be received; wherein the web page sends a resource request in response to an access instruction to an online document in an offline state; the resource request is used to obtain a first resource recorded in the online document; the resource manager is called according to the resource request, so that the resource manager returns a first local path; wherein the first resource is downloaded to the first local path through the resource manager when the online document is online; the first resource is obtained according to the first local path, and the first resource is returned to the web page, so that the web page renders and displays the first resource in the online document. By persisting the first resource contained in the online document to the first local path when the online document is online, the accessibility of the resource can be guaranteed when the document is offline or the network conditions are poor. Offline application of resources in online documents can be realized, which can improve user experience. BRIEF DESCRIPTION OF THE DRAWINGS
[0028] The above and other features, advantages and aspects of the embodiments of the present disclosure will become more apparent with reference to the following detailed description in conjunction with the accompanying drawings. Throughout the accompanying drawings, the same or similar reference numerals represent the same or similar elements. It should be understood that the drawings are schematic and the originals and elements are not necessarily drawn to scale.
[0029] Figure 1 A schematic diagram of a flow chart of a method for applying resources in an online document provided by an embodiment of the present disclosure;
[0030] Figure 2 A signaling interaction diagram of a method for applying resources in an online document provided by an embodiment of the present disclosure;
[0031] Figure 3 A schematic diagram of a flow chart of a method for applying resources in an online document provided by an embodiment of the present disclosure;
[0032] Figure 4 A signaling interaction diagram of a method for applying resources in an online document provided by an embodiment of the present disclosure;
[0033] Figure 5 A schematic diagram of the structure of an application device for resources in an online document provided by an embodiment of the present disclosure;
[0034] Figure 6 A schematic diagram of the structure of an application device for resources in an online document provided by an embodiment of the present disclosure;
[0035] Figure 7 A schematic diagram of the structure of an electronic device provided by an embodiment of the present disclosure. DETAILED DESCRIPTION
[0036] Embodiments of the present disclosure will be described in more detail below with reference to the accompanying drawings. Although certain embodiments of the present disclosure are shown in the accompanying drawings, it should be understood that the present disclosure can be implemented in various forms and should not be construed as being limited to the embodiments described herein, which are instead provided for a more thorough and complete understanding of the present disclosure. It should be understood that the drawings and embodiments of the present disclosure are only for exemplary purposes and are not intended to limit the scope of protection of the present disclosure.
[0037] It should be understood that the various steps described in the method embodiments of the present disclosure may be performed in different orders and / or in parallel. In addition, the method embodiments may include additional steps and / or omit the steps shown. The scope of the present disclosure is not limited in this respect.
[0038] The term "including" and its variations used herein are open inclusions, i.e., "including but not limited to". The term "based on" means "based at least in part on". The term "one embodiment" means "at least one embodiment"; the term "another embodiment" means "at least one additional embodiment"; the term "some embodiments" means "at least some embodiments". The relevant definitions of other terms will be given in the following description.
[0039] It should be noted that the concepts such as "first" and "second" mentioned in the present disclosure are only used to distinguish different devices, modules or units, and are not used to limit the order or interdependence of the functions performed by these devices, modules or units.
[0040] It should be noted that the modifications of "one" and "plurality" mentioned in the present disclosure are illustrative rather than restrictive, and those skilled in the art should understand that unless otherwise clearly indicated in the context, it should be understood as "one or more".
[0041] The names of the messages or information exchanged between multiple devices in the embodiments of the present disclosure are only used for illustrative purposes and are not used to limit the scope of these messages or information.
[0042] In the related art, when using online documents in a scenario where the user's network condition is poor or even offline, the resources in the document cannot be used normally. For example, resource requests may fail to load and cannot be previewed, or resource additions may fail to be uploaded to the server, resulting in resource loss after the document is opened again, etc., resulting in a poor user experience.
[0043] Figure 1 A flowchart of a method for applying resources in an online document provided by an embodiment of the present disclosure. The embodiment of the present disclosure is applicable to the offline application of resources in an online document, for example, to the offline display of resources. The method can be executed by an application device for resources in an online document (hereinafter referred to as an application device), which can be implemented in the form of software and / or hardware, and can be integrated into an online document application software (Application, APP), and can be installed in an electronic device along with the application software, such as a mobile device or a computer device.
[0044] like Figure 1 As shown, the method for applying resources in an online document provided in this embodiment may include:
[0045] S110, receiving a resource request for an online document sent by a web page; wherein the web page sends a resource request in response to an access instruction to an online document in an offline state; and the resource request is used to obtain a first resource recorded in the online document.
[0046] In the embodiments of the present disclosure, online documents can be understood as documents that can be accessed and edited online, and can have functions such as multi-person collaborative editing, sharing and storage. Among them, online document apps can include web pages, clients and resource managers. Among them, the web page can be understood as the code part of the online document app that is used to process page-related business logic, which can be represented by web; the client can be understood as the native code part of the online document app that can directly access the underlying hardware and operating system resources of the device, which can be represented by native; the resource manager can be understood as the code part of the online document app that is used to process resource-related business logic, which can be represented by rust. Among them, the application device can be considered as a client of the online document app, and the application method of resources in the online document provided in the embodiments of the present disclosure can be executed through the client.
[0047] The resources included in the online document may be referred to as first resources, and the number of first resources may include at least one. The first resource may include link resources, for example, at least one of the following: images, audio, video, tables, and documents.
[0048] In this embodiment, the client can obtain the network status of the electronic device to which it belongs, and can determine whether the online document is online or offline according to the network status. In the offline state, the web page of the online document APP can receive the access instruction of the online document, and can send a resource request to the client according to the access instruction to request the first resource.
[0049] S120: Calling a resource manager according to a resource request, so that the resource manager returns a first local path; wherein the first resource is downloaded to the first local path through the resource manager when the online document is online.
[0050] In the related art, the first resource can be requested from the server through the web page. In this embodiment, the process of the web page requesting the server can be simulated, and the resource request can be sent to the client through the web page. Accordingly, the resource request can be parsed through the parsing capability of the client, and the resource manager can be called according to the parsing result, so that the resource manager returns the first local path storing the first resource. Based on this, the web page can call the resource manager through the client.
[0051] S130. Acquire a first resource according to the first local path, and return the first resource to the web page, so that the web page renders and displays the first resource in the online document.
[0052] After the client obtains the first local path returned by the resource manager, the client can obtain the first resource from the first local path based on its local resource access capability. In addition, the obtained first resource can be returned to the web page. Accordingly, the web page can render and display the first resource based on an existing rendering method, so that the first resource in the online document is visible.
[0053] In some optional implementations, the resource request may include a request for a resource token containing a first resource generated based on a predefined protocol. The predefined protocol may include a custom communication protocol for simulating a server request. The resource token may be understood as an identifier of the entity content (e.g., binary content) of a resource, which may be represented by a token. The resource token of the first resource contained in the online document may be obtained through the web page, and a resource request containing the resource token may be generated according to the predefined protocol. Exemplarily, the resource request may be in the form of "native-resource: / / ××× / token".
[0054] Correspondingly, calling the resource manager according to the resource request may include: parsing the resource request according to a predefined protocol to obtain a resource token; calling the resource manager according to the resource token; wherein a first mapping relationship between the resource token and the first local path is maintained in the resource manager.
[0055] Among them, the construction process of the first mapping relationship may include: when the online document is online, through the web page, calling the resource manager according to the resource token, so that the resource manager downloads the first resource to the first local path; through the resource manager, constructing the first mapping relationship between the resource token and the first local path.
[0056] Among them, when the online document is online, the web page can respond to the setting item of whether it is available offline and set it to be available offline, and obtain the resource token of each first resource in the online document from the server; and the resource manager can be called to enable the resource manager to download the first resource corresponding to the resource token to the first local path; after the download is completed, the resource manager can construct and save the first mapping relationship between the resource token and the first local path to maintain the first mapping relationship.
[0057] Compared with the related art in which the web page requests the first resource from the server and caches it, the embodiment of the present disclosure can avoid cache failure when the browser cache is cleared or expired by persisting the first resource to a local path, so that the first resource of the online document can be continuously available and more stable in an offline state.
[0058] In these optional implementations, the client can parse the resource token in the resource request according to the predefined protocol, and can call the resource manager according to the resource token. Accordingly, the resource manager can determine the first local path corresponding to the resource token according to the first mapping relationship maintained internally, and return it to the client. By implementing the local resource request through the predefined protocol, a request for the first resource that is convenient, stable and controlled can be realized.
[0059] For example, Figure 2 The signaling interaction diagram of a method for applying resources in an online document provided by an embodiment of the present disclosure is shown in FIG. Figure 2 As shown, the method for applying resources in an online document provided in this embodiment can be applied to online document application software, and may include:
[0060] When the online document is online, the web page can first call the resource manager according to the resource token to enable the resource manager to download the first resource to the first local path. When the online document is online, the web page can call the resource manager according to the resource token of the first resource in response to the setting item available offline.
[0061] Afterwards, a first mapping relationship between the resource token and the first local path may be constructed through the resource manager.
[0062] In response to an access instruction of an online document in an offline state, first, a resource request for a first resource included in the online document may be sent to a client via a web page, wherein the resource request includes a request for a resource token of the first resource generated based on a predefined protocol, such as native-resource: / / ××× / token.
[0063] Secondly, the resource request can be parsed by the client according to the predefined protocol to obtain a resource token.
[0064] Thirdly, the client can call the resource manager according to the resource token so that the resource manager returns the first local path. The resource manager can determine the first local path corresponding to the resource token according to the first mapping relationship maintained internally, and return it to the client.
[0065] Then, the first resource can be obtained according to the first local path through the client, and the first resource can be returned to the web page.
[0066] Finally, the first resource can be rendered and displayed in an online document through a web page.
[0067] By persisting the first resource contained in the online document to the first local path when the online document is online, fast access to resources can be guaranteed when the document is offline or under poor network conditions. This is particularly important for application areas such as online education and remote office, and can greatly improve the user experience.
[0068] In addition, in some implementations, when the first resource has been downloaded to the first local path, in response to the access instruction of the online document in the online state, a resource request for the first resource contained in the online document can be sent to the client through the web page to execute steps S120-S140, so that the first resource in the online document is visible. Thus, for areas with high data costs, data usage can be reduced by reducing repeated resource requests, for example, requests for large documents, pictures and other resources can effectively save data costs. Moreover, when the online document is content that needs to be displayed in a service business, the stability of the service can be effectively guaranteed.
[0069] In the technical solution of the embodiment of the present disclosure, a resource request for an online document sent by a web page can be received; wherein the web page sends a resource request in response to an access instruction to an online document in an offline state; the resource request is used to obtain a first resource recorded in the online document; the resource manager is called according to the resource request, so that the resource manager returns a first local path; wherein the first resource is downloaded to the first local path through the resource manager when the online document is online; the first resource is obtained according to the first local path, and the first resource is returned to the web page, so that the web page renders and displays the first resource in the online document. By persisting the first resource contained in the online document to the first local path when the online document is online, the accessibility of the resource can be guaranteed when the document is offline or the network conditions are poor. Offline application of resources in online documents can be realized, which can improve user experience.
[0070] Figure 3 The present invention is a flowchart of a method for applying resources in an online document provided by an embodiment of the present invention. The present invention is applicable to the offline application of resources in an online document, for example, to the offline addition of resources. The method can be executed by an application device for resources in an online document, which can be implemented in the form of software and / or hardware. The application device can be integrated into online document application software and can be installed in an electronic device along with the application software, for example, in a mobile device or a computer device.
[0071] like Figure 3 As shown, the method for applying resources in an online document provided in this embodiment may include:
[0072] S310, receiving a path request for a second resource to be added sent by a web page; wherein the web page sends the path request in response to a resource adding instruction for an online document in an offline state; and the path request includes a first identifier of the second resource.
[0073] In this embodiment, the resource to be added in the online document may be referred to as a second resource. The second resource is essentially the same as the first resource, and may include a link resource, or may include at least one of the following: an image, an audio, a video, a table, and a document. The first identifier may uniquely represent the resource, and may be composed of at least one element such as letters, numbers, or symbols, and may be represented as (identity, ID).
[0074] When the online document is opened offline, the online document can be edited, for example, a second resource can be added to the online document. The second resource to be added can be selected locally by triggering the addition component in the display interface of the online document. Accordingly, the web page can receive the instruction to add the second resource, and can call the client according to the first identifier of the second resource carried in the instruction to add, so that the client receives the path request.
[0075] For example, Figure 4 The signaling interaction diagram of a method for applying resources in an online document provided by an embodiment of the present disclosure is shown in FIG. Figure 4 As shown, the application method of resources in online documents provided in this embodiment can be applied to online document application software, and may include: first, in response to an instruction to add a second resource in an offline state, a client can be called through a web page according to a first identifier of the second resource, so that the client receives a path request.
[0076] S320: Determine a second local path of the second resource according to the first identifier in the path request.
[0077] The client can parse the path request to obtain the first identifier, and based on its local resource access capability, the client can obtain the second local path corresponding to the first identifier, that is, the second local path of the second resource.
[0078] S330. Return the second local path to the web page so that the web page calls the resource manager according to the second local path, so that the resource manager copies the second resource to the preset storage path, generates a second identifier of the second resource, and constructs a second mapping relationship between the second identifier and the preset storage path.
[0079] See also Figure 4 , the second local path can be returned to the web page through the client. Correspondingly, the resource manager can be called according to the second local path through the web page, so that the resource manager copies the second resource to the preset storage path (for example, the preset cache directory). In addition, since the first identifier is not transmitted to the resource manager, another second identifier that uniquely represents the resource can be generated through the resource manager; a second mapping relationship between the second identifier and the preset storage path can also be constructed through the resource manager, and the second identifier can be returned to the web page.
[0080] S340, receiving the second identifier sent by the web page, and constructing a third mapping relationship between the first identifier and the second identifier; wherein the second mapping relationship and the third mapping relationship are used for uploading the second resource when the online document is online.
[0081] See again Figure 4 , the client can be called according to the second identifier through the web page, so that the client constructs a third mapping relationship between the first identifier and the second identifier, and persistently stores the third mapping relationship.
[0082] Since the web page itself has the ability to call the client and the resource manager, the client and the resource manager can be connected through the web page, so that the resource manager can copy the second resource based on the second local path returned by the client, and the client can build a third mapping relationship based on the second identifier returned by the resource manager. In addition, in this embodiment, by copying the second resource to the specified preset storage path, not only can the failure of adding the second resource when the second local path changes be avoided, but also multiple versions of the continuously edited second resource can be retained, so that any version of the second resource can be added, improving the user experience.
[0083] In some optional ways, the uploading process of the second resource may include:
[0084] First, a request for identifying a second resource sent by a web page is received; wherein the web page sends the request in response to the online document switching from an offline state to an online state; and the request includes a first identifier of the second resource. Figure 4 When the network of the electronic device of the resource application device in the online document is restored, the online document can be switched from an offline state to an online state. At this time, the web page can send an identification request for the second resource to the client according to the first identification obtained when adding the second resource.
[0085] Afterwards, the second identifier of the second resource is determined according to the first identifier in the identifier request and the third mapping relationship. Figure 4 In the embodiment, the second identifier corresponding to the first identifier can be determined by the client according to the third mapping relationship.
[0086] Finally, the second identifier is returned to the web page so that the web page calls the resource manager according to the second identifier, so that the resource manager determines the preset storage path according to the second identifier and the second mapping relationship, and uploads the second resource in the preset storage path to the server.
[0087] Figure 4 In the example, the second identifier can be returned to the web page through the client. Accordingly, the resource manager can be called according to the second identifier through the web page; the preset storage path corresponding to the second identifier can be determined according to the second mapping relationship through the resource manager, and the second resource corresponding to the second identifier under the preset storage path can be uploaded to the server, so that the server can update the online document according to the second resource. Thus, the second resource can be successfully added in the offline state.
[0088] In some further methods, enabling the resource manager to upload the second resource in the preset storage path to the server may include: enabling the resource manager to obtain the second resource from the preset storage path, and calling the preset upload tool according to the second resource, so as to upload the second resource to the server through the preset upload tool.
[0089] See again Figure 4 , the resource manager can obtain the second resource from the preset storage path, and call the preset upload tool according to the second resource to upload the second resource to the server through the preset upload tool. In these further implementations, the preset upload tool may include a software development kit (Software Development Kit, SDK) with a data upload function. The resource manager can first read the second resource from the preset storage path, and then call the preset upload tool so that the preset upload tool executes the upload of the second resource. In addition, after the preset upload tool completes uploading the second resource, it can also return a message of the upload completion to the resource manager. The resource manager can send a notification message to the web page to prompt that the online document edited offline has been successfully synchronized to the server, thereby improving the user experience.
[0090] In the technical solution of the embodiment of the present disclosure, a path request for a second resource to be added sent by a web page can be received; wherein, the web page sends a path request in response to a resource addition instruction for an online document in an offline state; the path request includes a first identifier of the second resource; according to the first identifier in the path request, a second local path of the second resource is determined; the second local path is returned to the web page, so that the web page calls a resource manager according to the second local path, so that the resource manager copies the second resource to a preset storage path, generates a second identifier of the second resource, and constructs a second mapping relationship between the second identifier and the preset storage path; the second identifier sent by the web page is received, and a third mapping relationship between the first identifier and the second identifier is constructed; wherein the second mapping relationship and the third mapping relationship are used for uploading the second resource when the online document is online.
[0091] By copying the resources added in the offline state of the online document to the preset storage path, and persisting the mapping relationship required for uploading the resources to the client and the resource manager, it can be ensured that when the online document is switched back to the online state, the resources in the preset storage path are uploaded to the server through the mapping relationship to avoid the loss of resources added in the offline state. It is possible to add offline resources in online documents without waiting for network request responses, which can reduce the inconvenience of user waiting and operation and improve user experience. In addition, the application method of resources in online documents provided in the embodiment of the present disclosure belongs to the same public concept as the application method of resources in online documents provided in the above embodiment. The technical details not described in detail in this embodiment can be referred to the above embodiment, and the same technical features have the same beneficial effects in this embodiment and the above embodiment.
[0092] Figure 5The schematic diagram of the structure of an application device for resources in an online document provided by an embodiment of the present disclosure is applicable to offline application of resources in an online document, for example, offline display of resources.
[0093] like Figure 5 As shown, the application device of resources in the online document provided by the embodiment of the present disclosure may include:
[0094] The first receiving module 510 is used to receive a resource request for an online document sent by a web page; wherein the web page sends a resource request in response to an access instruction to an online document in an offline state; and the resource request is used to obtain a first resource recorded in the online document;
[0095] A first path determination module 520 is used to call a resource manager according to a resource request so that the resource manager returns a first local path; wherein the first resource is downloaded to the first local path through the resource manager when the online document is online;
[0096] The rendering and display module 530 is used to obtain the first resource according to the first local path, and return the first resource to the web page, so that the web page renders and displays the first resource in the online document.
[0097] In some optional implementations, the resource request includes a request for a resource token containing a first resource generated based on a predefined protocol; and the first path determination module may be configured to:
[0098] Parse the resource request according to the predefined protocol to obtain a resource token;
[0099] The resource manager is called according to the resource token; wherein a first mapping relationship between the resource token and the first local path is maintained in the resource manager.
[0100] In some optional implementations, the application device of the resource in the online document may further include:
[0101] A resource download module, used to call a resource manager according to a resource token through a web page when the online document is online, so that the resource manager downloads a first resource to a first local path;
[0102] The first relationship building module is used to build a first mapping relationship between a resource token and a first local path through a resource manager.
[0103] In some optional implementations, the first resource includes at least one of the following: an image, an audio, a video, a table, and a document.
[0104] The application device for resources in online documents provided by the embodiments of the present disclosure can execute the application method for resources in online documents provided by the embodiments of the present disclosure, and has the functional modules and beneficial effects corresponding to the execution method. It is worth noting that the various units and modules included in the above-mentioned device are only divided according to functional logic, but are not limited to the above-mentioned division, as long as the corresponding functions can be realized; in addition, the specific names of the functional units are only for the convenience of distinguishing each other, and are not used to limit the protection scope of the embodiments of the present disclosure.
[0105] Figure 6 The schematic diagram of the structure of an online document resource application device provided by the embodiment of the present disclosure is applicable to the offline application of online document resources, for example, the offline addition of resources.
[0106] like Figure 6 As shown, the application device of resources in the online document provided by the embodiment of the present disclosure may include:
[0107] The second receiving module 610 is used to receive a path request for a second resource to be added sent by the web page; wherein the web page sends the path request in response to a resource adding instruction for an online document in an offline state; and the path request includes a first identifier of the second resource;
[0108] A second path determination module 620, configured to determine a second local path of a second resource according to a first identifier in the path request;
[0109] The resource persistence module 630 is used to return the second local path to the web page end, so that the web page end calls the resource manager according to the second local path, so that the resource manager copies the second resource to the preset storage path, generates a second identifier of the second resource, and constructs a second mapping relationship between the second identifier and the preset storage path;
[0110] The second receiving module 610 is further used to receive the second identifier sent by the web page, and to construct a third mapping relationship between the first identifier and the second identifier; wherein the second mapping relationship and the third mapping relationship are used for uploading the second resource when the online document is online.
[0111] In some optional implementations, the second receiving module may also be used to receive an identification request for a second resource sent by the web page; wherein the web page sends the identification request in response to the online document being switched from an offline state to an online state; and the identification request includes a first identification of the second resource;
[0112] The application device of the resources in the online document may also include:
[0113] An identification determination module, used to determine a second identification of a second resource according to the first identification in the identification request and a third mapping relationship;
[0114] The resource upload module is used to return the second identifier to the web page so that the web page calls the resource manager according to the second identifier, so that the resource manager determines the preset storage path according to the second identifier and the second mapping relationship, and uploads the second resource in the preset storage path to the server.
[0115] In some optional implementations, the resource upload module can be used to:
[0116] The resource manager is enabled to obtain the second resource from the preset storage path, and to call the preset upload tool according to the second resource, so as to upload the second resource to the server through the preset upload tool.
[0117] The application device for resources in online documents provided by the embodiments of the present disclosure can execute the application method for resources in online documents provided by the embodiments of the present disclosure, and has the functional modules and beneficial effects corresponding to the execution method. It is worth noting that the various units and modules included in the above-mentioned device are only divided according to functional logic, but are not limited to the above-mentioned division, as long as the corresponding functions can be realized; in addition, the specific names of the functional units are only for the convenience of distinguishing each other, and are not used to limit the protection scope of the embodiments of the present disclosure.
[0118] Reference below Figure 7 , which shows an electronic device (eg, Figure 7 The terminal device in the embodiment of the present disclosure may include but is not limited to mobile terminals such as mobile phones, notebook computers, digital broadcast receivers, PDAs (personal digital assistants), PADs (tablet computers), PMPs (portable multimedia players), vehicle-mounted terminals (such as vehicle-mounted navigation terminals), etc., and fixed terminals such as digital TVs, desktop computers, etc. Figure 7 The electronic device shown is only an example and should not bring any limitation to the functions and scope of use of the embodiments of the present disclosure.
[0119] like Figure 7As shown, the electronic device 700 may include a processing device (e.g., a central processing unit, a graphics processing unit, etc.) 701, which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM) 702 or a program loaded from a storage device 708 to a random access memory (RAM) 703. In the RAM 703, various programs and data required for the operation of the electronic device 700 are also stored. The processing device 701, the ROM 702, and the RAM 703 are connected to each other via a bus 704. An input / output (I / O) interface 705 is also connected to the bus 704.
[0120] Typically, the following devices may be connected to the I / O interface 705: an input device 706 including, for example, a touch screen, a touch pad, a keyboard, a mouse, a camera, a microphone, an accelerometer, a gyroscope, etc.; an output device 707 including, for example, a liquid crystal display (LCD), a speaker, a vibrator, etc.; a storage device 708 including, for example, a magnetic tape, a hard disk, etc.; and a communication device 709. The communication device 709 may allow the electronic device 700 to communicate with other devices wirelessly or by wire to exchange data. Although Figure 7 The electronic device 700 is shown with various devices, but it should be understood that it is not required to implement or possess all the devices shown. More or fewer devices may be implemented or possessed instead.
[0121] In particular, according to an embodiment of the present disclosure, the process described above with reference to the flowchart can be implemented as a computer software program. For example, an embodiment of the present disclosure includes a computer program product, which includes a computer program carried on a non-transitory computer-readable medium, and the computer program contains program code for executing the method shown in the flowchart. In such an embodiment, the computer program can be downloaded and installed from the network through the communication device 709, or installed from the storage device 708, or installed from the ROM 702. When the computer program is executed by the processing device 701, the above-mentioned functions defined in the application method of the resource in the online document of the embodiment of the present disclosure are executed.
[0122] The electronic device provided by the embodiment of the present disclosure and the method for applying resources in online documents provided by the above embodiment belong to the same public concept. For technical details not fully described in this embodiment, reference can be made to the above embodiment, and this embodiment has the same beneficial effects as the above embodiment.
[0123] The embodiments of the present disclosure provide a storage medium of computer executable instructions. When the computer executable instructions are executed by a computer processor, they can be used to execute the resource application method in the online document provided by the above embodiments.
[0124] It should be noted that the storage medium disclosed above may be a computer-readable signal medium or a computer-readable storage medium or any combination of the above two. The computer-readable storage medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or device, or any combination of the above. More specific examples of computer-readable storage media may include, but are not limited to: an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM) or a flash memory (FLASH), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In the present disclosure, a computer-readable storage medium may be any tangible medium containing or storing executable instructions, which may be used by or in combination with an instruction execution system, device or device. In the present disclosure, a computer-readable signal medium may include a data signal propagated in a baseband or as part of a carrier wave, which carries a computer-readable executable instruction. Such propagated data signals may take a variety of forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the above. Computer readable signal media may also be any computer readable medium other than computer readable storage media, which may send, propagate, or transmit executable instructions for use by or in conjunction with an instruction execution system, apparatus, or device. The executable instructions contained on the storage medium may be transmitted using any suitable medium, including but not limited to: wires, optical cables, RF (radio frequency), etc., or any suitable combination of the above.
[0125] In some embodiments, the client and the server may communicate using any currently known or future developed network protocol such as HTTP (Hyper Text Transfer Protocol), and may be interconnected with any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include a local area network ("LAN"), a wide area network ("WAN"), an internet (e.g., the Internet), and a peer-to-peer network (e.g., an ad hoc peer-to-peer network), as well as any currently known or future developed network.
[0126] The storage medium may be included in the electronic device, or may exist independently without being installed in the electronic device.
[0127] The storage medium carries one or more executable instructions. When the one or more executable instructions are executed by the electronic device, the electronic device:
[0128] Receive a resource request for an online document sent by a web page; wherein the web page sends a resource request in response to an access instruction to an online document in an offline state; the resource request is used to obtain a first resource recorded in the online document; a resource manager is called according to the resource request, so that the resource manager returns a first local path; wherein the first resource is downloaded to the first local path through the resource manager when the online document is online; the first resource is obtained according to the first local path, and the first resource is returned to the web page, so that the web page renders and displays the first resource in the online document.
[0129] Alternatively, the electronic device:
[0130] Receive a path request for a second resource to be added sent by a web page; wherein the web page sends a path request in response to a resource addition instruction for an online document in an offline state; the path request includes a first identifier of the second resource; according to the first identifier in the path request, determine a second local path of the second resource; return the second local path to the web page, so that the web page calls a resource manager according to the second local path, so that the resource manager copies the second resource to a preset storage path, generates a second identifier of the second resource, and constructs a second mapping relationship between the second identifier and the preset storage path; receive the second identifier sent by the web page, and construct a third mapping relationship between the first identifier and the second identifier; wherein the second mapping relationship and the third mapping relationship are used for uploading the second resource when the online document is online.
[0131] Executable instructions for performing the operations of the present disclosure may be written in one or more programming languages or a combination thereof, including, but not limited to, object-oriented programming languages such as Java, Smalltalk, C++, and conventional procedural programming languages such as "C" or similar programming languages. The executable instructions may be executed entirely on the user's computer, partially on the user's computer, as a separate software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In cases involving a remote computer, the remote computer may be connected to the user's computer through any type of network, including a local area network (LAN) or a wide area network (WAN), or may be connected to an external computer (e.g., through the Internet using an Internet service provider).
[0132] The embodiments of the present disclosure further provide a computer program product, including a computer program, which, when executed by a processor, can implement a method for applying resources in an online document as provided in any embodiment of the present disclosure.
[0133] In the process of implementation, the computer program product can be written in one or more programming languages or a combination thereof to perform the computer program code for the disclosed operation, including object-oriented programming languages, such as Java, Smalltalk, C++, and conventional procedural programming languages, such as "C" language or similar programming languages. The program code can be executed entirely on the user's computer, partially on the user's computer, as a separate software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In the case of a remote computer, the remote computer can be connected to the user's computer through any type of network, including a local area network (LAN) or a wide area network (WAN), or can be connected to an external computer (e.g., using an Internet service provider to connect through the Internet).
[0134] The flow chart and block diagram in the accompanying drawings illustrate the possible architecture, function and operation of the system, method and computer program product according to various embodiments of the present disclosure. In this regard, each square box in the flow chart or block diagram can represent a module, a program segment or a part of a code, and the module, the program segment or a part of the code contains one or more executable instructions for realizing the specified logical function. It should also be noted that in some implementations as replacements, the functions marked in the square box can also occur in a sequence different from that marked in the accompanying drawings. For example, two square boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each square box in the block diagram and / or flow chart, and the combination of the square boxes in the block diagram and / or flow chart can be implemented with a dedicated hardware-based system that performs a specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions.
[0135] The units involved in the embodiments described in the present disclosure may be implemented by software or hardware, wherein the names of the units and modules do not, in some cases, limit the units and modules themselves.
[0136] The functions described above herein may be performed at least in part by one or more hardware logic components. For example, without limitation, exemplary types of hardware logic components that may be used include: Field Programmable Gate Array (FPGA), Application Specific Integrated Circuit (ASIC), Application Specific Standard Parts (ASSP), System on Chip (SOC), Complex Programmable Logic Device (CPLD), etc.
[0137] In the context of the present disclosure, a machine-readable medium may be a tangible medium that may contain or store a program for use by or in conjunction with an instruction execution system, device, or equipment. A machine-readable medium may be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium may include, but is not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, device, or equipment, or any suitable combination of the foregoing. A more specific example of a machine-readable storage medium may include an electrical connection based on one or more lines, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.
[0138] According to one or more embodiments of the present disclosure, a method for applying resources in an online document is provided, the method comprising:
[0139] Receiving a resource request for an online document sent by a web page; wherein the web page sends the resource request in response to an access instruction to the online document in an offline state; the resource request is used to obtain a first resource recorded in the online document;
[0140] Invoke a resource manager according to the resource request, so that the resource manager returns a first local path; wherein the first resource is downloaded to the first local path through the resource manager when the online document is online;
[0141] The first resource is acquired according to the first local path, and the first resource is returned to the web page, so that the web page renders and displays the first resource in the online document.
[0142] According to one or more embodiments of the present disclosure, a method for applying resources in an online document is provided, further comprising:
[0143] In some optional implementations, the resource request includes a request generated based on a predefined protocol and including a resource token of the first resource;
[0144] The calling of the resource manager according to the resource request comprises:
[0145] Parsing the resource request according to the predefined protocol to obtain a resource token;
[0146] The resource manager is called according to the resource token; wherein a first mapping relationship between the resource token and the first local path is maintained in the resource manager.
[0147] According to one or more embodiments of the present disclosure, a method for applying resources in an online document is provided, further comprising:
[0148] In some optional implementations, the process of constructing the first mapping relationship includes:
[0149] When the online document is online, the resource manager is called according to the resource token through the web page, so that the resource manager downloads the first resource to the first local path;
[0150] A first mapping relationship between the resource token and the first local path is constructed through the resource manager.
[0151] According to one or more embodiments of the present disclosure, a method for applying resources in an online document is provided, further comprising:
[0152] In some optional implementations, the first resource includes at least one of the following: an image, an audio, a video, a table, and a document.
[0153] According to one or more embodiments of the present disclosure, a method for applying resources in an online document is provided, the method comprising:
[0154] Receiving a path request for a second resource to be added sent by a web page; wherein the web page sends the path request in response to a resource adding instruction for an online document in an offline state; and the path request includes a first identifier of the second resource;
[0155] Determine a second local path of the second resource according to the first identifier in the path request;
[0156] Returning the second local path to the web page end, so that the web page end calls the resource manager according to the second local path, so that the resource manager copies the second resource to a preset storage path, generates a second identifier of the second resource, and constructs a second mapping relationship between the second identifier and the preset storage path;
[0157] Receive the second identifier sent by the web page, and construct a third mapping relationship between the first identifier and the second identifier; wherein the second mapping relationship and the third mapping relationship are used for uploading the second resource when the online document is online.
[0158] According to one or more embodiments of the present disclosure, a method for applying resources in an online document is provided, further comprising:
[0159] In some optional implementations, the uploading process of the second resource includes:
[0160] Receiving an identification request for the second resource sent by the web page; wherein the web page sends the identification request in response to the online document being switched from an offline state to an online state; the identification request includes a first identification of the second resource;
[0161] Determine a second identifier of the second resource according to the first identifier in the identifier request and the third mapping relationship;
[0162] The second identifier is returned to the web page so that the web page calls the resource manager according to the second identifier, so that the resource manager determines the preset storage path according to the second identifier and the second mapping relationship, and uploads the second resource in the preset storage path to the server.
[0163] According to one or more embodiments of the present disclosure, a method for applying resources in an online document is provided, further comprising:
[0164] In some optional implementations, enabling the resource manager to upload the second resource in the preset storage path to the server includes:
[0165] The resource manager is enabled to obtain the second resource from the preset storage path, and to call a preset upload tool according to the second resource, so as to upload the second resource to the server through the preset upload tool.
[0166] According to one or more embodiments of the present disclosure, a device for applying resources in an online document is provided, the device comprising:
[0167] A first receiving module, configured to receive a resource request for an online document sent by a web page; wherein the web page sends the resource request in response to an access instruction to the online document in an offline state; and the resource request is used to obtain a first resource recorded in the online document;
[0168] A first path determination module is used to call a resource manager according to the resource request, so that the resource manager returns a first local path; wherein the first resource is downloaded to the first local path through the resource manager when the online document is online;
[0169] A rendering and display module is used to obtain the first resource according to the first local path, and return the first resource to the web page, so that the web page renders and displays the first resource in the online document.
[0170] According to one or more embodiments of the present disclosure, a device for applying resources in an online document is provided, the device comprising:
[0171] A second receiving module is used to receive a path request for a second resource to be added sent by a web page; wherein the web page sends the path request in response to a resource adding instruction for an online document in an offline state; and the path request includes a first identifier of the second resource;
[0172] A second path determination module, configured to determine a second local path of the second resource according to the first identifier in the path request;
[0173] A resource persistence module, used to return the second local path to the web page end, so that the web page end calls the resource manager according to the second local path, so that the resource manager copies the second resource to a preset storage path, generates a second identifier of the second resource, and constructs a second mapping relationship between the second identifier and the preset storage path;
[0174] The second receiving module is also used to receive the second identifier sent by the web page and construct a third mapping relationship between the first identifier and the second identifier; wherein the second mapping relationship and the third mapping relationship are used for uploading the second resource when the online document is online.
[0175] The above description is only a preferred embodiment of the present disclosure and an explanation of the technical principles used. Those skilled in the art should understand that the scope of disclosure involved in the present disclosure is not limited to the technical solutions formed by a specific combination of the above technical features, but should also cover other technical solutions formed by any combination of the above technical features or their equivalent features without departing from the above disclosed concept. For example, the above features are replaced with the technical features with similar functions disclosed in the present disclosure (but not limited to) by each other to form a technical solution.
[0176] In addition, although each operation is described in a specific order, this should not be understood as requiring these operations to be performed in the specific order shown or in a sequential order. Under certain circumstances, multitasking and parallel processing may be advantageous. Similarly, although some specific implementation details are included in the above discussion, these should not be interpreted as limiting the scope of the present disclosure. Some features described in the context of a separate embodiment can also be implemented in a single embodiment in combination. On the contrary, the various features described in the context of a single embodiment can also be implemented in multiple embodiments individually or in any suitable sub-combination mode.
[0177] Although the subject matter has been described in language specific to structural features and / or methodological logical actions, it should be understood that the subject matter defined in the appended claims is not necessarily limited to the specific features or actions described above. On the contrary, the specific features and actions described above are merely example forms of implementing the claims.
Claims
1. A method for applying resources in an online document, characterized in that: include: Receiving a resource request for an online document sent by a web page; wherein the web page sends the resource request in response to an access instruction to the online document in an offline state; the resource request is used to obtain a first resource recorded in the online document; Invoke a resource manager according to the resource request, so that the resource manager returns a first local path; wherein the first resource is downloaded to the first local path through the resource manager when the online document is online; The first resource is acquired according to the first local path, and the first resource is returned to the web page, so that the web page renders and displays the first resource in the online document.
2. The method according to claim 1, characterized in that The resource request includes a request generated based on a predefined protocol and including a resource token of the first resource; The calling of the resource manager according to the resource request comprises: Parsing the resource request according to the predefined protocol to obtain a resource token; The resource manager is called according to the resource token; wherein a first mapping relationship between the resource token and the first local path is maintained in the resource manager.
3. The method according to claim 2, characterized in that The process of constructing the first mapping relationship includes: When the online document is online, the resource manager is called according to the resource token through the web page, so that the resource manager downloads the first resource to the first local path; A first mapping relationship between the resource token and the first local path is constructed through the resource manager.
4. The method according to any one of claims 1 to 3, characterized in that: The first resource includes at least one of the following: an image, an audio, a video, a table, and a document.
5. A method for applying resources in an online document, characterized in that: include: Receiving a path request for a second resource to be added sent by a web page; wherein the web page sends the path request in response to a resource adding instruction for an online document in an offline state; and the path request includes a first identifier of the second resource; Determine a second local path of the second resource according to the first identifier in the path request; Returning the second local path to the web page end, so that the web page end calls the resource manager according to the second local path, so that the resource manager copies the second resource to a preset storage path, generates a second identifier of the second resource, and constructs a second mapping relationship between the second identifier and the preset storage path; Receive the second identifier sent by the web page, and construct a third mapping relationship between the first identifier and the second identifier; wherein the second mapping relationship and the third mapping relationship are used for uploading the second resource when the online document is online.
6. The method according to claim 5, characterized in that The uploading process of the second resource includes: Receiving an identification request for the second resource sent by the web page; wherein the web page sends the identification request in response to the online document being switched from an offline state to an online state; the identification request includes a first identification of the second resource; Determine a second identifier of the second resource according to the first identifier in the identifier request and the third mapping relationship; The second identifier is returned to the web page so that the web page calls the resource manager according to the second identifier, so that the resource manager determines the preset storage path according to the second identifier and the second mapping relationship, and uploads the second resource in the preset storage path to the server.
7. The method according to claim 6, characterized in that So that the resource manager uploads the second resource in the preset storage path to the server, including: The resource manager is enabled to obtain the second resource from the preset storage path, and to call a preset upload tool according to the second resource, so as to upload the second resource to the server through the preset upload tool.
8. An application device for resources in an online document, characterized in that: include: A first receiving module, configured to receive a resource request for an online document sent by a web page; wherein the web page sends the resource request in response to an access instruction to the online document in an offline state; and the resource request is used to obtain a first resource recorded in the online document; A first path determination module is used to call a resource manager according to the resource request, so that the resource manager returns a first local path; wherein the first resource is downloaded to the first local path through the resource manager when the online document is online; A rendering and display module is used to obtain the first resource according to the first local path, and return the first resource to the web page, so that the web page renders and displays the first resource in the online document.
9. An application device for resources in an online document, characterized in that: include: A second receiving module is used to receive a path request for a second resource to be added sent by a web page; wherein the web page sends the path request in response to a resource adding instruction for an online document in an offline state; and the path request includes a first identifier of the second resource; A second path determination module, configured to determine a second local path of the second resource according to the first identifier in the path request; A resource persistence module, used to return the second local path to the web page end, so that the web page end calls the resource manager according to the second local path, so that the resource manager copies the second resource to a preset storage path, generates a second identifier of the second resource, and constructs a second mapping relationship between the second identifier and the preset storage path; The second receiving module is also used to receive the second identifier sent by the web page and construct a third mapping relationship between the first identifier and the second identifier; wherein the second mapping relationship and the third mapping relationship are used for uploading the second resource when the online document is online.
10. An electronic device, characterized in that: The electronic device comprises: one or more processors; a storage device for storing one or more programs, When the one or more programs are executed by the one or more processors, the one or more processors implement the method for applying resources in an online document as described in any one of claims 1-4 or claims 5-7.
11. A storage medium comprising computer executable instructions, wherein when the computer executable instructions are executed by a computer processor, the computer executable instructions are used to execute the method for applying resources in an online document as claimed in any one of claims 1 to 4 or claims 5 to 7.
12. A computer program product, characterized in that The computer program product comprises a computer program, and when the computer program is executed by a processor, the computer program implements the method for applying resources in an online document as claimed in any one of claims 1 to 4 or claims 5 to 7.